@@ -10,6 +10,7 @@ import type { AppSettings } from '../../../src/shared/settings.js';
1010import type { TransportInfo } from '../../../src/shared/transport-info.js' ;
1111import { ALL_BUILTIN_TOOL_IDS , TOOL_ID_GROUPS } from '@llmindset/hf-mcp' ;
1212import { extractAuthBouquetAndMix } from '../../../src/server/utils/auth-utils.js' ;
13+ import { normalizeBuiltInTools } from '../../../src/shared/tool-normalizer.js' ;
1314
1415describe ( 'extractBouquetAndMix' , ( ) => {
1516 it ( 'should extract bouquet from headers' , ( ) => {
@@ -169,7 +170,7 @@ describe('ToolSelectionStrategy', () => {
169170 const result = await strategy . selectTools ( context ) ;
170171
171172 expect ( result . mode ) . toBe ( ToolSelectionMode . BOUQUET_OVERRIDE ) ;
172- expect ( result . enabledToolIds ) . toEqual ( ALL_BUILTIN_TOOL_IDS ) ;
173+ expect ( result . enabledToolIds ) . toEqual ( normalizeBuiltInTools ( ALL_BUILTIN_TOOL_IDS ) ) ;
173174 expect ( result . reason ) . toBe ( 'Bouquet override: all' ) ;
174175 } ) ;
175176
@@ -183,7 +184,7 @@ describe('ToolSelectionStrategy', () => {
183184
184185 // Should fall through to fallback since no valid bouquet or user settings
185186 expect ( result . mode ) . toBe ( ToolSelectionMode . FALLBACK ) ;
186- expect ( result . enabledToolIds ) . toEqual ( ALL_BUILTIN_TOOL_IDS ) ;
187+ expect ( result . enabledToolIds ) . toEqual ( normalizeBuiltInTools ( ALL_BUILTIN_TOOL_IDS ) ) ;
187188 } ) ;
188189
189190 it ( 'should prefer bouquet over mix when both are present' , async ( ) => {
@@ -287,7 +288,7 @@ describe('ToolSelectionStrategy', () => {
287288
288289 // Should fall through to fallback since no user settings to mix with
289290 expect ( result . mode ) . toBe ( ToolSelectionMode . FALLBACK ) ;
290- expect ( result . enabledToolIds ) . toEqual ( ALL_BUILTIN_TOOL_IDS ) ;
291+ expect ( result . enabledToolIds ) . toEqual ( normalizeBuiltInTools ( ALL_BUILTIN_TOOL_IDS ) ) ;
291292 } ) ;
292293
293294 it ( 'should ignore invalid mix bouquet names' , async ( ) => {
@@ -380,7 +381,7 @@ describe('ToolSelectionStrategy', () => {
380381 const result = await strategy . selectTools ( context ) ;
381382
382383 expect ( result . mode ) . toBe ( ToolSelectionMode . FALLBACK ) ;
383- expect ( result . enabledToolIds ) . toEqual ( ALL_BUILTIN_TOOL_IDS ) ;
384+ expect ( result . enabledToolIds ) . toEqual ( normalizeBuiltInTools ( ALL_BUILTIN_TOOL_IDS ) ) ;
384385 expect ( result . reason ) . toBe ( 'Fallback - no settings available' ) ;
385386 expect ( result . baseSettings ) . toBeUndefined ( ) ;
386387 } ) ;
@@ -394,7 +395,7 @@ describe('ToolSelectionStrategy', () => {
394395 const result = await strategy . selectTools ( context ) ;
395396
396397 expect ( result . mode ) . toBe ( ToolSelectionMode . FALLBACK ) ;
397- expect ( result . enabledToolIds ) . toEqual ( ALL_BUILTIN_TOOL_IDS ) ;
398+ expect ( result . enabledToolIds ) . toEqual ( normalizeBuiltInTools ( ALL_BUILTIN_TOOL_IDS ) ) ;
398399 } ) ;
399400 } ) ;
400401
@@ -457,7 +458,7 @@ describe('ToolSelectionStrategy', () => {
457458 expect ( result . mixedBouquet ) . toBe ( bouquetName ) ;
458459
459460 const expectedTools = [ ...new Set ( [ ...userSettings . builtInTools , ...bouquetConfig . builtInTools ] ) ] ;
460- expect ( result . enabledToolIds ) . toEqual ( expectedTools ) ;
461+ expect ( result . enabledToolIds ) . toEqual ( normalizeBuiltInTools ( expectedTools ) ) ;
461462 }
462463 } ) ;
463464
@@ -494,7 +495,7 @@ describe('ToolSelectionStrategy', () => {
494495
495496 // Should get user's minimal tools + ALL built-in tools (deduplicated)
496497 const expectedBuiltInTools = [ ...new Set ( [ ...userSettings . builtInTools , ...ALL_BUILTIN_TOOL_IDS ] ) ] ;
497- expect ( result . enabledToolIds ) . toEqual ( expectedBuiltInTools ) ;
498+ expect ( result . enabledToolIds ) . toEqual ( normalizeBuiltInTools ( expectedBuiltInTools ) ) ;
498499
499500 // Should preserve base settings including gradio endpoints
500501 expect ( result . baseSettings ) . toEqual ( userSettings ) ;
0 commit comments