6a949b54ba
Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
873 B
TypeScript
28 lines
873 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { parseScenePlanJson } from '../../src/main/services/auto-parse.service'
|
|
|
|
describe('parseScenePlanJson', () => {
|
|
it('parses valid scene plan', () => {
|
|
const json = JSON.stringify({
|
|
scenes: [
|
|
{
|
|
label: '开场',
|
|
summary: '林远步入演武场,众人围观,测灵石前气氛紧张,他感受到体内灵力涌动。'
|
|
},
|
|
{
|
|
label: '异变',
|
|
summary: '测灵石突然碎裂,长老震惊,同门哗然,林远意识到自己的天赋远超预期。'
|
|
}
|
|
],
|
|
estimatedWords: 3000
|
|
})
|
|
const plan = parseScenePlanJson(json)
|
|
expect(plan.scenes).toHaveLength(2)
|
|
expect(plan.estimatedWords).toBe(3000)
|
|
})
|
|
|
|
it('throws on invalid JSON', () => {
|
|
expect(() => parseScenePlanJson('not json')).toThrow()
|
|
})
|
|
})
|