a8e0ba9ac9
Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
1.1 KiB
TypeScript
18 lines
1.1 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { parsePlotsJson, parseNamingRequiredJson } from '../../src/main/services/interactive-parse.service'
|
|
|
|
describe('interactive-parse', () => {
|
|
it('parses three plot options', () => {
|
|
const json = `{"plots":[{"id":"A","label":"锋芒","summary":"林远展露天赋引起轰动,同门侧目,长老暗中关注其来历与隐患。"},{"id":"B","label":"藏锋","summary":"林远按长老暗示收敛灵力,被安排在外门修行,暗中调查测灵石异变。"},{"id":"C","label":"转折","summary":"测灵石碎裂引发异象,闭关太上长老出关,宗门上下震动。"}]}`
|
|
const plots = parsePlotsJson(json)
|
|
expect(plots).toHaveLength(3)
|
|
expect(plots[0].summary.length).toBeGreaterThanOrEqual(10)
|
|
})
|
|
|
|
it('parses naming_required payload', () => {
|
|
const json = `{"type":"naming_required","elementType":"角色","context":"需要为新同伴命名","options":["名1","名2","名3","名4","名5"]}`
|
|
const pause = parseNamingRequiredJson(json)
|
|
expect(pause.options).toHaveLength(5)
|
|
})
|
|
})
|