@@ -359,7 +359,6 @@ test('should display connectionInfo message if there is no running connection',
359
359
} as unknown as ModelInfo ,
360
360
] ) ;
361
361
vi . mocked ( modelsInfoStore ) . modelsInfo = modelsInfoList ;
362
- router . location . query . set ( 'model-id' , 'id' ) ;
363
362
render ( CreateService ) ;
364
363
365
364
await vi . waitFor ( ( ) => {
@@ -383,7 +382,6 @@ test('should display connectionInfo message if there is a podman connection with
383
382
} as unknown as ModelInfo ,
384
383
] ) ;
385
384
vi . mocked ( modelsInfoStore ) . modelsInfo = modelsInfoList ;
386
- router . location . query . set ( 'model-id' , 'id' ) ;
387
385
render ( CreateService ) ;
388
386
389
387
await vi . waitFor ( ( ) => {
@@ -404,11 +402,48 @@ test('there should be NO banner if there is a running podman connection having e
404
402
} as unknown as ModelInfo ,
405
403
] ) ;
406
404
vi . mocked ( modelsInfoStore ) . modelsInfo = modelsInfoList ;
407
- router . location . query . set ( 'model-id' , 'id' ) ;
408
405
render ( CreateService ) ;
409
406
410
407
await vi . waitFor ( ( ) => {
411
408
const banner = screen . queryByLabelText ( 'Container connection info banner' ) ;
412
409
expect ( banner ) . not . toBeInTheDocument ( ) ;
413
410
} ) ;
414
411
} ) ;
412
+
413
+ test ( 'model-id query should be used to select default model' , async ( ) => {
414
+ const modelsInfoList = writable < ModelInfo [ ] > ( [
415
+ {
416
+ id : 'model-id-1' ,
417
+ file : {
418
+ file : 'file' ,
419
+ path : '/path' ,
420
+ } ,
421
+ } as unknown as ModelInfo ,
422
+ {
423
+ id : 'model-id-2' ,
424
+ file : {
425
+ file : 'file' ,
426
+ path : '/path' ,
427
+ } ,
428
+ } as unknown as ModelInfo ,
429
+ ] ) ;
430
+ vi . mocked ( modelsInfoStore ) . modelsInfo = modelsInfoList ;
431
+ router . location . query . set ( 'model-id' , 'model-id-2' ) ;
432
+
433
+ render ( CreateService ) ;
434
+ const createBtn = screen . getByTitle ( 'Create service' ) ;
435
+
436
+ await vi . waitFor ( ( ) => {
437
+ expect ( createBtn ) . toBeEnabled ( ) ;
438
+ } ) ;
439
+
440
+ await fireEvent . click ( createBtn ) ;
441
+
442
+ await vi . waitFor ( ( ) => {
443
+ expect ( studioClient . requestCreateInferenceServer ) . toHaveBeenCalledWith ( {
444
+ modelsInfo : [ expect . objectContaining ( { id : 'model-id-2' } ) ] ,
445
+ port : 8888 ,
446
+ connection : containerProviderConnection ,
447
+ } ) ;
448
+ } ) ;
449
+ } ) ;
0 commit comments