@@ -9,7 +9,7 @@ import { SyncTarget } from '../../src/app/services/settings/sync-target';
99import  *  as  schema  from  '../../../core/api-schemas/files-list.json' ; 
1010
1111const  fs  =  require ( 'fs' ) ; 
12- const  execSync  =  require ( 'child_process'  ) . execSync ; 
12+ const  axios  =  require ( 'axios'  ) ; 
1313
1414
1515/** 
@@ -23,13 +23,15 @@ describe('ImageSyncService', () => {
2323    const  mockImage : Buffer  =  fs . readFileSync ( process . cwd ( )  +  '/test/test-data/logo.png' ) ; 
2424    const  testFilePath  =  process . cwd ( )  +  '/test/test-temp/imagestore/' ; 
2525    const  testProjectIdentifier  =  'test_tmp_project' ; 
26-     const  hubContainer  =  'field-hub-client-integration-test' ; 
2726
2827    const  ajv  =  new  Ajv ( ) ; 
2928    const  validate  =  ajv . compile ( schema ) ; 
3029
3130    // see desktop/test/hub-integration/docker-compose.yml 
32-     const  fieldHubTestBasicAuth  =  'Basic '  +  Buffer . from ( "client_integration_test:pw" ) . toString ( 'base64' ) ; 
31+     const  fieldHubAdminCredentials  =  { 
32+         username : "client_integration_test" , 
33+         password : "pw" 
34+     } 
3335
3436    const  syncTarget : SyncTarget  =  { 
3537        // see desktop/test/hub-integration/docker-compose.yml 
@@ -82,28 +84,24 @@ describe('ImageSyncService', () => {
8284
8385        await  imageStore . init ( `${ testFilePath }  ,  testProjectIdentifier ) ; 
8486
85-         let  headers  =  new  Headers ( ) ; 
86-         headers . set ( 'Authorization' ,  fieldHubTestBasicAuth ) ; 
87-         const  request  =  new  Request ( `${ syncTarget . address } ${ testProjectIdentifier }  ,  { 
88-             method : "POST" , 
89-             body : JSON . stringify ( {  password : syncTarget . password  } ) , 
90-             headers : headers 
87+         await  axios ( { 
88+             method : 'post' , 
89+             baseURL : `${ syncTarget . address } ${ testProjectIdentifier }  , 
90+             auth : fieldHubAdminCredentials , 
91+             data : {  password : syncTarget . password  } 
9192        } ) 
92-         fetch ( request ) ; 
9393    } ) ; 
9494
9595
9696    afterEach ( async  ( )  =>  { 
9797
9898        await  imageStore . deleteData ( testProjectIdentifier ) ; 
9999
100-         let  headers  =  new  Headers ( ) ; 
101-         headers . set ( 'Authorization' ,  fieldHubTestBasicAuth ) ; 
102-         const  request  =  new  Request ( `${ syncTarget . address } ${ testProjectIdentifier }  ,  { 
103-             method : "DELETE" , 
104-             headers : headers 
100+         await  axios ( { 
101+             method : 'delete' , 
102+             baseURL : `${ syncTarget . address } ${ testProjectIdentifier }  , 
103+             auth : fieldHubAdminCredentials 
105104        } ) 
106-         fetch ( request ) ; 
107105    } ) ; 
108106
109107
0 commit comments