feat: 補齊工具一(最新章節狀態、作品用語、語言欄位、貼上章節、台詞引號檢查)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
8c25728206
commit
fb04b0fa23
@@ -102,3 +102,27 @@ test('schema 驗證失敗不寫檔、不建 PR;cancel 清除待確認', async
|
||||
expect([...s.files.keys()].some(k => k.includes('characters'))).toBe(false)
|
||||
expect(await run($ as never, 'cancel')).toContain('已取消')
|
||||
})
|
||||
|
||||
test('貼上章節內容:paste <章節名稱> 加下一行起的內容,並寫入語言欄位與 index.json', async ($, on) => {
|
||||
const s = setup(on as never, [reply(char({ language: '繁體中文,少量原作口癖' }))])
|
||||
await $.session.start({ source: 'startup', cwd: '/repo' } as never)
|
||||
expect(await run($ as never, 'paste')).toContain('貼上章節的用法')
|
||||
const t1 = await run($ as never, 'paste 第一章\n這是貼上的章節內容。')
|
||||
expect(t1).toContain('aoi')
|
||||
expect(s.prompts[0]).toContain('這是貼上的章節內容。')
|
||||
await run($ as never, 'confirm')
|
||||
await run($ as never, 'confirm')
|
||||
const pack = JSON.parse(s.files.get('/repo/characters/ts/aoi.json')!)
|
||||
expect(pack.timeline[0].chapter).toBe('第一章')
|
||||
expect(pack.language).toBe('繁體中文,少量原作口癖')
|
||||
expect(JSON.parse(s.files.get('/repo/characters/index.json')!).packs[0]).toEqual({ work: 'ts', workName: '測試物語', slug: 'aoi' })
|
||||
})
|
||||
|
||||
test('欄位含長段引號內容視為抄錄原作台詞,不寫檔', async ($, on) => {
|
||||
const quoted = char({ persona: { selfRef: '我', address: '你', tone: '「這是一段很長很長的原作台詞內容,不應該出現在角色包裡面」', catchphrase: '加油', values: '誠實', taboos: '背叛' } })
|
||||
const s = setup(on as never, [reply(quoted)], new Map([['/repo/ch1.txt', 'a']]))
|
||||
await $.session.start({ source: 'startup', cwd: '/repo' } as never)
|
||||
await run($ as never, 'ch1.txt')
|
||||
expect(await run($ as never, 'confirm')).toContain('疑似抄錄原作台詞')
|
||||
expect([...s.files.keys()].some(k => k.includes('characters'))).toBe(false)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user