@@ -74,7 +74,26 @@ describe('api/_performApiRequest', () => {
7474 } ) ;
7575 afterEach ( mockFetch . tearDown ) ;
7676
77- it . only ( 'should set the correct request, method and HTTP Headers' , async ( ) => {
77+ it ( 'should set the correct request, method and HTTP Headers' , async ( ) => {
78+ const mock = mockEndpoint ( Endpoint . SIGN_UP , serverResponse ) ;
79+ const response = await _performApiRequest <
80+ typeof request ,
81+ typeof serverResponse
82+ > ( auth , HttpMethod . POST , Endpoint . SIGN_UP , request ) ;
83+ expect ( response ) . to . eql ( serverResponse ) ;
84+ expect ( mock . calls . length ) . to . eq ( 1 ) ;
85+ expect ( mock . calls [ 0 ] . method ) . to . eq ( HttpMethod . POST ) ;
86+ expect ( mock . calls [ 0 ] . request ) . to . eql ( request ) ;
87+ expect ( mock . calls [ 0 ] . headers ! . get ( HttpHeader . CONTENT_TYPE ) ) . to . eq (
88+ 'application/json'
89+ ) ;
90+ expect ( mock . calls [ 0 ] . headers ! . get ( HttpHeader . X_CLIENT_VERSION ) ) . to . eq (
91+ 'testSDK/0.0.0'
92+ ) ;
93+ expect ( mock . calls [ 0 ] . fullRequest ?. credentials ) . to . be . undefined ;
94+ } ) ;
95+
96+ it ( 'should set credentials to "include" when using IDX and emulator' , async ( ) => {
7897 const mock = mockEndpoint ( Endpoint . SIGN_UP , serverResponse ) ;
7998 auth . emulatorConfig = {
8099 host : 'https://something.cloudworkstations.dev' ,
@@ -84,7 +103,7 @@ describe('api/_performApiRequest', () => {
84103 disableWarnings : false
85104 }
86105 } ;
87- const response = await _performApiRequest <
106+ await _performApiRequest <
88107 typeof request ,
89108 typeof serverResponse
90109 > ( auth , HttpMethod . POST , Endpoint . SIGN_UP , request ) ;
0 commit comments