mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
fix: 修复 prefetch 测试 — turn-zero 推荐已禁用,测试期望值同步更新
getTurnZeroSearchExtraToolsPrefetch 在 commit 2cf18c4c 中被禁用(始终返回 null),
但测试仍期望匹配时返回非 null attachment。更新三个用例全部期望 null。
This commit is contained in:
@@ -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 () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user