fix: 修复 prefetch 测试 — turn-zero 推荐已禁用,测试期望值同步更新

getTurnZeroSearchExtraToolsPrefetch 在 commit 2cf18c4c 中被禁用(始终返回 null),
但测试仍期望匹配时返回非 null attachment。更新三个用例全部期望 null。
This commit is contained in:
claude-code-best
2026-05-09 17:02:40 +08:00
parent 2cf18c4c49
commit 547ce9e848

View File

@@ -149,14 +149,12 @@ describe('startSearchExtraToolsPrefetch', () => {
}) })
describe('getTurnZeroSearchExtraToolsPrefetch', () => { describe('getTurnZeroSearchExtraToolsPrefetch', () => {
beforeEach(() => { // Turn-zero user-input tool recommendations are disabled to avoid frequent
// popups. All cases return null regardless of input/match state.
test('returns null (feature disabled)', async () => {
mockGetToolIndex.mockResolvedValue([ mockGetToolIndex.mockResolvedValue([
{ name: 'index-entry', tokens: ['test'], tfVector: new Map() }, { name: 'index-entry', tokens: ['test'], tfVector: new Map() },
] as never) ] as never)
mockSearchTools.mockReturnValue([])
})
test('returns non-null attachment for matching tools', async () => {
mockSearchTools.mockReturnValue([ mockSearchTools.mockReturnValue([
{ {
name: 'CronCreateTool', name: 'CronCreateTool',
@@ -173,9 +171,7 @@ describe('getTurnZeroSearchExtraToolsPrefetch', () => {
'schedule cron job', 'schedule cron job',
[], [],
) )
expect(result).not.toBeNull() expect(result).toBeNull()
expect(result!.type).toBe('tool_discovery')
expect((result as Record<string, unknown>).trigger).toBe('user_input')
}) })
test('returns null for empty input', async () => { test('returns null for empty input', async () => {