返回 oh-my-ppt
intent-router.test.ts
根目录 / tests / unit / thinking / intent-router.test.ts
1 import { describe, expect, it } from 'vitest'
2 import { routeThinkingIntent } from '../../../src/main/thinking/intent-router'
3
4 describe('thinking intent router', () => {
5 it('routes detail expansion to draft intent', () => {
6 const route = routeThinkingIntent({
7 currentStage: 'outline',
8 userMessage: '完善一下细节吧'
9 })
10
11 expect(route.intent).toBe('expand_draft')
12 expect(route.requestedStage).toBe('draft')
13 expect(route.confidence).toBe('high')
14 })
15
16 it('routes outline planning requests from collect', () => {
17 const route = routeThinkingIntent({
18 currentStage: 'collect',
19 userMessage: '需要设计'
20 })
21
22 expect(route.intent).toBe('plan_outline')
23 expect(route.requestedStage).toBe('outline')
24 })
25
26 it('does not force a transition for ordinary requirement collection', () => {
27 const route = routeThinkingIntent({
28 currentStage: 'collect',
29 userMessage: '技术从业者 分享会,大致10分钟'
30 })
31
32 expect(route.intent).toBe('collect_info')
33 expect(route.requestedStage).toBeNull()
34 })
35 })
36
36 lines TYPESCRIPT