Files
dj/huobao-source/backend/tests/storyboard-script-ending.test.ts
T
2026-11-13 11:46:25 +08:00

14 lines
1.0 KiB
TypeScript

import test from 'node:test'
import assert from 'node:assert/strict'
import {scriptEndingCue,endingShotIndex} from '../src/utils/storyboard-script-ending.js'
test('identify unique long terminal speech and ignore punctuation differences',()=>{
const cue=scriptEndingCue('前情。\n高天明:(低声)乔雨灵,信我一次!按剧本喊出来!剩下的交给老子!')
assert.ok(cue)
assert.equal(endingShotIndex([{description:'前半段'},{video_prompt:'0-9秒:@高天明说:「乔雨灵,信我一次,按剧本喊出来!剩下的交给老子!」'},{description:'不应生成的新剧情'}],cue),1)
})
test('do not prematurely stop on repeated or short dialogue or an action ending',()=>{
assert.equal(scriptEndingCue('高天明:好!'),'')
assert.equal(scriptEndingCue('他离开房间,关上门。'),'')
assert.equal(scriptEndingCue('甲:这句对白前面已经出现了很多次一定不能作为终点。\n乙:这句对白前面已经出现了很多次一定不能作为终点。'),'')
})