test(stage-ui): updated

This commit is contained in:
Neko Ayaka
2026-06-18 15:14:31 +08:00
parent 4ba237c5c0
commit c029e8c444
2 changed files with 9 additions and 30 deletions
@@ -190,15 +190,15 @@ describe('store character-orchestrator', () => {
expect(result?.commands?.[0].intent).toBe('action')
expect(result?.commands?.[0].priority).toBe('critical')
expect(mockStream).toBeCalledTimes(1)
expect(mockStream).toHaveBeenCalledTimes(1)
expect(mockStream.mock.calls).toHaveLength(1)
expect(mockStream.mock.calls[0][0]).toEqual('mock-model')
expect(mockStream.mock.calls[0][1]).not.toBeNull()
expect(mockStream.mock.calls[0][2]).toHaveLength(2)
expect(mockStream.mock.calls[0][3]).toHaveProperty('tools')
expect(mockOnSparkNotifyReactionStreamEvent).toBeCalledWith(event.data.id, 'Ahhh, got hit by zombie!')
expect(mockOnSparkNotifyReactionStreamEnd).toBeCalledTimes(1)
expect(mockOnSparkNotifyReactionStreamEvent).toHaveBeenCalledWith(event.data.id, 'Ahhh, got hit by zombie!')
expect(mockOnSparkNotifyReactionStreamEnd).toHaveBeenCalledTimes(1)
})
it('supports forcing text-only spark:notify responses', async () => {
@@ -237,8 +237,8 @@ describe('store character-orchestrator', () => {
expect(streamOptions.waitForTools).toBe(false)
expect(streamOptions.tools).toEqual([])
expect(streamOptions.toolChoice).toBeUndefined()
expect(onDelta).toBeCalled()
expect(onEnd).toBeCalled()
expect(onDelta).toHaveBeenCalled()
expect(onEnd).toHaveBeenCalled()
})
it('supports forcing spark-command responses', async () => {
@@ -291,8 +291,8 @@ describe('store character-orchestrator', () => {
function: { name: 'builtIn_sparkCommand' },
})
expect(result?.commands?.length).toBe(1)
expect(onDelta).not.toBeCalled()
expect(onEnd).toBeCalledWith(event.data.id, '')
expect(onDelta).not.toHaveBeenCalled()
expect(onEnd).toHaveBeenCalledWith(event.data.id, '')
})
it('forwards runtime-only message overrides into the rendered spark prompt', async () => {
+2 -23
View File
@@ -2,38 +2,17 @@ import { join } from 'node:path'
import { cwd } from 'node:process'
import Vue from '@vitejs/plugin-vue'
import Info from 'unplugin-info/vite'
import { playwright } from '@vitest/browser-playwright'
import { loadEnv } from 'vite'
import { defineConfig } from 'vitest/config'
function BuildInfoTestPlugin() {
return {
name: 'stage-ui-test-build-info',
resolveId(id: string) {
if (id === '~build/git' || id === '~build/time')
return `\0${id}`
},
load(id: string) {
if (id === '\0~build/git') {
return [
'export const abbreviatedSha = "test-sha"',
'export const branch = "test-branch"',
].join('\n')
}
if (id === '\0~build/time') {
return 'export default "2026-05-07T00:00:00.000Z"'
}
},
}
}
export default defineConfig(({ mode }) => {
return {
root: import.meta.dirname,
plugins: [
BuildInfoTestPlugin(),
Info(),
],
test: {
projects: [