@@ -17,63 +17,65 @@ describe('Foundry Local Manager Tests', () => {
1717 expect ( catalog . name ) . to . be . a ( 'string' ) ;
1818 } ) ;
1919
20- it ( 'downloadAndRegisterEps should call command without params when names are omitted' , function ( ) {
20+ it ( 'downloadAndRegisterEps should call command without params when names are omitted' , async function ( ) {
2121 const manager = getTestManager ( ) as any ;
2222 const calls : unknown [ ] [ ] = [ ] ;
23- const originalExecuteCommand = manager . coreInterop . executeCommand ;
23+ const originalExecuteCommandStreaming = manager . coreInterop . executeCommandStreaming ;
2424
25- manager . coreInterop . executeCommand = ( ...args : unknown [ ] ) => {
25+ manager . coreInterop . executeCommandStreaming = ( ...args : unknown [ ] ) => {
2626 calls . push ( args ) ;
27- return JSON . stringify ( {
27+ return Promise . resolve ( JSON . stringify ( {
2828 Success : true ,
2929 Status : 'All providers registered' ,
3030 RegisteredEps : [ 'CUDAExecutionProvider' ] ,
3131 FailedEps : [ ]
32- } ) ;
32+ } ) ) ;
3333 } ;
3434
3535 try {
36- const result = manager . downloadAndRegisterEps ( ) ;
37- expect ( calls ) . to . deep . equal ( [ [ 'download_and_register_eps' , undefined ] ] ) ;
36+ const result = await manager . downloadAndRegisterEps ( ) ;
37+ expect ( calls . length ) . to . equal ( 1 ) ;
38+ expect ( calls [ 0 ] [ 0 ] ) . to . equal ( 'download_and_register_eps' ) ;
39+ expect ( calls [ 0 ] [ 1 ] ) . to . be . undefined ;
3840 expect ( result ) . to . deep . equal ( {
3941 success : true ,
4042 status : 'All providers registered' ,
4143 registeredEps : [ 'CUDAExecutionProvider' ] ,
4244 failedEps : [ ]
4345 } ) ;
4446 } finally {
45- manager . coreInterop . executeCommand = originalExecuteCommand ;
47+ manager . coreInterop . executeCommandStreaming = originalExecuteCommandStreaming ;
4648 }
4749 } ) ;
4850
49- it ( 'downloadAndRegisterEps should send Names param when subset is provided' , function ( ) {
51+ it ( 'downloadAndRegisterEps should send Names param when subset is provided' , async function ( ) {
5052 const manager = getTestManager ( ) as any ;
5153 const calls : unknown [ ] [ ] = [ ] ;
52- const originalExecuteCommand = manager . coreInterop . executeCommand ;
54+ const originalExecuteCommandStreaming = manager . coreInterop . executeCommandStreaming ;
5355
54- manager . coreInterop . executeCommand = ( ...args : unknown [ ] ) => {
56+ manager . coreInterop . executeCommandStreaming = ( ...args : unknown [ ] ) => {
5557 calls . push ( args ) ;
56- return JSON . stringify ( {
58+ return Promise . resolve ( JSON . stringify ( {
5759 Success : false ,
5860 Status : 'Some providers failed' ,
5961 RegisteredEps : [ 'CUDAExecutionProvider' ] ,
6062 FailedEps : [ 'OpenVINOExecutionProvider' ]
61- } ) ;
63+ } ) ) ;
6264 } ;
6365
6466 try {
65- const result = manager . downloadAndRegisterEps ( [ 'CUDAExecutionProvider' , 'OpenVINOExecutionProvider' ] ) ;
66- expect ( calls ) . to . deep . equal ( [
67- [ 'download_and_register_eps' , { Params : { Names : 'CUDAExecutionProvider,OpenVINOExecutionProvider' } } ]
68- ] ) ;
67+ const result = await manager . downloadAndRegisterEps ( [ 'CUDAExecutionProvider' , 'OpenVINOExecutionProvider' ] ) ;
68+ expect ( calls . length ) . to . equal ( 1 ) ;
69+ expect ( calls [ 0 ] [ 0 ] ) . to . equal ( 'download_and_register_eps' ) ;
70+ expect ( calls [ 0 ] [ 1 ] ) . to . deep . equal ( { Params : { Names : 'CUDAExecutionProvider,OpenVINOExecutionProvider' } } ) ;
6971 expect ( result ) . to . deep . equal ( {
7072 success : false ,
7173 status : 'Some providers failed' ,
7274 registeredEps : [ 'CUDAExecutionProvider' ] ,
7375 failedEps : [ 'OpenVINOExecutionProvider' ]
7476 } ) ;
7577 } finally {
76- manager . coreInterop . executeCommand = originalExecuteCommand ;
78+ manager . coreInterop . executeCommandStreaming = originalExecuteCommandStreaming ;
7779 }
7880 } ) ;
7981} ) ;
0 commit comments