@@ -2,9 +2,16 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
22
33vi . mock ( '@midscene/core/ai-model' , ( ) => ( {
44 callAIWithStringResponse : vi . fn ( ) ,
5+ getModelRuntime : vi . fn ( ( config ) => ( {
6+ config,
7+ adapter : { } ,
8+ } ) ) ,
59} ) ) ;
610
7- import { callAIWithStringResponse } from '@midscene/core/ai-model' ;
11+ import {
12+ callAIWithStringResponse ,
13+ getModelRuntime ,
14+ } from '@midscene/core/ai-model' ;
815import { runConnectivityTest } from '../src/main/playground/connectivity-test' ;
916
1017describe ( 'runConnectivityTest' , ( ) => {
@@ -27,6 +34,16 @@ describe('runConnectivityTest', () => {
2734 ok : true ,
2835 sample : 'CONNECTIVITY_OK' ,
2936 } ) ;
37+ expect ( getModelRuntime ) . toHaveBeenCalledWith (
38+ expect . objectContaining ( {
39+ openaiApiKey : 'sk-test' ,
40+ openaiBaseURL : 'https://api.example.com/v1' ,
41+ modelName : 'gpt-4o' ,
42+ intent : 'default' ,
43+ slot : 'default' ,
44+ timeout : 30_000 ,
45+ } ) ,
46+ ) ;
3047 expect ( callAIWithStringResponse ) . toHaveBeenCalledWith (
3148 [
3249 {
@@ -39,12 +56,14 @@ describe('runConnectivityTest', () => {
3956 } ,
4057 ] ,
4158 expect . objectContaining ( {
42- openaiApiKey : 'sk-test' ,
43- openaiBaseURL : 'https://api.example.com/v1' ,
44- modelName : 'gpt-4o' ,
45- intent : 'default' ,
46- slot : 'default' ,
47- timeout : 30_000 ,
59+ config : expect . objectContaining ( {
60+ openaiApiKey : 'sk-test' ,
61+ openaiBaseURL : 'https://api.example.com/v1' ,
62+ modelName : 'gpt-4o' ,
63+ intent : 'default' ,
64+ slot : 'default' ,
65+ timeout : 30_000 ,
66+ } ) ,
4867 } ) ,
4968 expect . objectContaining ( {
5069 abortSignal : expect . any ( AbortSignal ) ,
0 commit comments