test(conversation): brand fixture sequences

This commit is contained in:
imccyu 2026-09-01 21:14:19 +08:00
parent 443efeeba3
commit 7db2bab853
2 changed files with 12 additions and 11 deletions

View file

@ -167,8 +167,8 @@ function fallbackDefinition(start: () => string): ConversationNodeDefinition<str
describe('ConversationNodeAssembler', () => {
it('publishes Location data through stable per-key sources', () => {
const index = new ConversationLocationIndex()
const turnStart = at(1, 'turn/start', { turn: 1 })
const stepStart = at(2, 'step/start', { turn: 1, step: 1 })
const turnStart = at(SessionSeq(1), 'turn/start', { turn: 1 })
const stepStart = at(SessionSeq(2), 'step/start', { turn: 1, step: 1 })
index.rebuild([input(turnStart), input(stepStart)])
const location = index.locationOf(stepStart)
if (location.kind !== 'step') throw new Error('scope probe requires a Step Location')
@ -1088,16 +1088,16 @@ describe('ConversationNodeAssembler', () => {
new TestViewDefinitions([testView(apply)]),
)
assembler.replaceWindow([
input(at(1, 'turn/start', { turn: 1 })),
input(at(2, 'step/start', { turn: 1, step: 1 })),
input(at(SessionSeq(1), 'turn/start', { turn: 1 })),
input(at(SessionSeq(2), 'step/start', { turn: 1, step: 1 })),
], false)
assembler.flush()
assembler.append(input(at(3, 'scope-probe/update', { turn: 1, step: 1, changed: false })))
assembler.append(input(at(SessionSeq(3), 'scope-probe/update', { turn: 1, step: 1, changed: false })))
expect(assembler.flush()).toBe(false)
expect(apply).not.toHaveBeenCalled()
assembler.append(input(at(4, 'scope-probe/update', { turn: 1, step: 1, changed: true })))
assembler.append(input(at(SessionSeq(4), 'scope-probe/update', { turn: 1, step: 1, changed: true })))
expect(assembler.flush()).toBe(true)
expect(apply).toHaveBeenCalledOnce()
})

View file

@ -1,5 +1,6 @@
import { Context } from '@deepseek-ai/cordis'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { SessionSeq } from '@deepseek-ai/dsh-session/types'
import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session/types'
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
import {
@ -181,16 +182,16 @@ describe('Conversation registries', () => {
source.append({ type: 'event', event })
}
append({ seq: 1, time: 1, type: 'turn/start', data: { turn: 1 } })
append({ seq: SessionSeq(1), time: 1, type: 'turn/start', data: { turn: 1 } })
listener.mockClear()
append({
seq: 2,
seq: SessionSeq(2),
time: 2,
type: 'assistant/chunk',
data: { turn: 1, step: 1, chunk: { type: 'text-delta', index: 0, text: 'a' } },
})
append({
seq: 3,
seq: SessionSeq(3),
time: 3,
type: 'assistant/chunk',
data: { turn: 1, step: 1, chunk: { type: 'text-delta', index: 0, text: 'b' } },
@ -219,13 +220,13 @@ describe('Conversation registries', () => {
expect(listener).toHaveBeenCalledOnce()
append({
seq: 4,
seq: SessionSeq(4),
time: 4,
type: 'assistant/chunk',
data: { turn: 1, step: 1, chunk: { type: 'text-delta', index: 0, text: 'c' } },
})
append({
seq: 5,
seq: SessionSeq(5),
time: 5,
type: 'assistant/message',
data: { turn: 1, step: 1, message: { id: 'a1', role: 'assistant', content: [] } },