@@ -22,7 +22,7 @@ describe('extractBouquetAndMix', () => {
2222 const result = extractAuthBouquetAndMix ( headers ) ;
2323
2424 expect ( result . bouquet ) . toBeUndefined ( ) ;
25- expect ( result . mix ) . toBe ( 'hf_api' ) ;
25+ expect ( result . mix ) . toEqual ( [ 'hf_api' ] ) ;
2626 } ) ;
2727
2828 it ( 'should extract both bouquet and mix from headers' , ( ) => {
@@ -33,7 +33,7 @@ describe('extractBouquetAndMix', () => {
3333 const result = extractAuthBouquetAndMix ( headers ) ;
3434
3535 expect ( result . bouquet ) . toBe ( 'search' ) ;
36- expect ( result . mix ) . toBe ( 'hf_api' ) ;
36+ expect ( result . mix ) . toEqual ( [ 'hf_api' ] ) ;
3737 } ) ;
3838
3939 it ( 'should handle null headers' , ( ) => {
@@ -49,6 +49,13 @@ describe('extractBouquetAndMix', () => {
4949 expect ( result . bouquet ) . toBeUndefined ( ) ;
5050 expect ( result . mix ) . toBeUndefined ( ) ;
5151 } ) ;
52+
53+ it ( 'should parse comma-separated mix list' , ( ) => {
54+ const headers = { 'x-mcp-mix' : 'hf_api, jobs ,hub_repo_details_readme' } ;
55+ const result = extractAuthBouquetAndMix ( headers ) ;
56+
57+ expect ( result . mix ) . toEqual ( [ 'hf_api' , 'jobs' , 'hub_repo_details_readme' ] ) ;
58+ } ) ;
5259} ) ;
5360
5461describe ( 'BOUQUETS configuration' , ( ) => {
@@ -224,7 +231,7 @@ describe('ToolSelectionStrategy', () => {
224231 expect ( result . mode ) . toBe ( ToolSelectionMode . MIX ) ;
225232 expect ( result . reason ) . toBe ( 'User settings + mix(hf_api)' ) ;
226233 expect ( result . baseSettings ) . toEqual ( userSettings ) ;
227- expect ( result . mixedBouquet ) . toBe ( 'hf_api' ) ;
234+ expect ( result . mixedBouquet ) . toEqual ( [ 'hf_api' ] ) ;
228235
229236 // Should contain user tools + hf_api tools (deduplicated)
230237 const expectedTools = [ ...new Set ( [ ...userSettings . builtInTools , ...TOOL_ID_GROUPS . hf_api ] ) ] ;
@@ -274,6 +281,30 @@ describe('ToolSelectionStrategy', () => {
274281 expect ( result . enabledToolIds . length ) . toBe ( uniqueTools . length ) ;
275282 } ) ;
276283
284+ it ( 'should mix multiple bouquets when comma separated' , async ( ) => {
285+ const userSettings : AppSettings = {
286+ builtInTools : [ 'hf_whoami' ] ,
287+ spaceTools : [ ] ,
288+ } ;
289+
290+ const context : ToolSelectionContext = {
291+ headers : { 'x-mcp-mix' : 'hf_api,search' } ,
292+ userSettings,
293+ hfToken : 'test-token' ,
294+ } ;
295+
296+ const result = await strategy . selectTools ( context ) ;
297+
298+ expect ( result . mode ) . toBe ( ToolSelectionMode . MIX ) ;
299+ expect ( result . reason ) . toBe ( 'User settings + mix(hf_api,search)' ) ;
300+ expect ( result . mixedBouquet ) . toEqual ( [ 'hf_api' , 'search' ] ) ;
301+
302+ const expectedTools = normalizeBuiltInTools ( [
303+ ...new Set ( [ ...userSettings . builtInTools , ...TOOL_ID_GROUPS . hf_api , ...TOOL_ID_GROUPS . search ] ) ,
304+ ] ) ;
305+ expect ( result . enabledToolIds ) . toEqual ( expectedTools ) ;
306+ } ) ;
307+
277308 it ( 'should ignore mix when no user settings available' , async ( ) => {
278309 const context : ToolSelectionContext = {
279310 headers : { 'x-mcp-mix' : 'hf_api' } ,
@@ -431,7 +462,7 @@ describe('ToolSelectionStrategy', () => {
431462
432463 expect ( result . mode ) . toBe ( ToolSelectionMode . MIX ) ;
433464 expect ( result . enabledToolIds ) . toEqual ( TOOL_ID_GROUPS . search ) ;
434- expect ( result . mixedBouquet ) . toBe ( 'search' ) ;
465+ expect ( result . mixedBouquet ) . toEqual ( [ 'search' ] ) ;
435466 } ) ;
436467
437468 it ( 'should handle all possible tool types in mix' , async ( ) => {
@@ -451,7 +482,7 @@ describe('ToolSelectionStrategy', () => {
451482 const result = await strategy . selectTools ( context ) ;
452483
453484 expect ( result . mode ) . toBe ( ToolSelectionMode . MIX ) ;
454- expect ( result . mixedBouquet ) . toBe ( bouquetName ) ;
485+ expect ( result . mixedBouquet ) . toEqual ( [ bouquetName ] ) ;
455486
456487 const expectedTools = [ ...new Set ( [ ...userSettings . builtInTools , ...bouquetConfig . builtInTools ] ) ] ;
457488 expect ( result . enabledToolIds ) . toEqual ( normalizeBuiltInTools ( expectedTools ) ) ;
@@ -486,7 +517,7 @@ describe('ToolSelectionStrategy', () => {
486517 const result = await strategy . selectTools ( context ) ;
487518
488519 expect ( result . mode ) . toBe ( ToolSelectionMode . MIX ) ;
489- expect ( result . mixedBouquet ) . toBe ( 'all' ) ;
520+ expect ( result . mixedBouquet ) . toEqual ( [ 'all' ] ) ;
490521 expect ( result . reason ) . toBe ( 'User settings + mix(all)' ) ;
491522
492523 // Should get user's minimal tools + ALL built-in tools (deduplicated)
0 commit comments