@@ -26,22 +26,22 @@ describe('instantiate client', () => {
2626 apiKey : 'My API Key' ,
2727 } ) ;
2828
29- test ( 'they are used in the request' , ( ) => {
30- const { req } = client . buildRequest ( { path : '/foo' , method : 'post' } ) ;
29+ test ( 'they are used in the request' , async ( ) => {
30+ const { req } = await client . buildRequest ( { path : '/foo' , method : 'post' } ) ;
3131 expect ( req . headers . get ( 'x-my-default-header' ) ) . toEqual ( '2' ) ;
3232 } ) ;
3333
34- test ( 'can ignore `undefined` and leave the default' , ( ) => {
35- const { req } = client . buildRequest ( {
34+ test ( 'can ignore `undefined` and leave the default' , async ( ) => {
35+ const { req } = await client . buildRequest ( {
3636 path : '/foo' ,
3737 method : 'post' ,
3838 headers : { 'X-My-Default-Header' : undefined } ,
3939 } ) ;
4040 expect ( req . headers . get ( 'x-my-default-header' ) ) . toEqual ( '2' ) ;
4141 } ) ;
4242
43- test ( 'can be removed with `null`' , ( ) => {
44- const { req } = client . buildRequest ( {
43+ test ( 'can be removed with `null`' , async ( ) => {
44+ const { req } = await client . buildRequest ( {
4545 path : '/foo' ,
4646 method : 'post' ,
4747 headers : { 'X-My-Default-Header' : null } ,
@@ -348,7 +348,7 @@ describe('instantiate client', () => {
348348 } ) ;
349349
350350 describe ( 'withOptions' , ( ) => {
351- test ( 'creates a new client with overridden options' , ( ) => {
351+ test ( 'creates a new client with overridden options' , async ( ) => {
352352 const client = new Flowglad ( { baseURL : 'http://localhost:5000/' , maxRetries : 3 , apiKey : 'My API Key' } ) ;
353353
354354 const newClient = client . withOptions ( {
@@ -369,7 +369,7 @@ describe('instantiate client', () => {
369369 expect ( newClient . constructor ) . toBe ( client . constructor ) ;
370370 } ) ;
371371
372- test ( 'inherits options from the parent client' , ( ) => {
372+ test ( 'inherits options from the parent client' , async ( ) => {
373373 const client = new Flowglad ( {
374374 baseURL : 'http://localhost:5000/' ,
375375 defaultHeaders : { 'X-Test-Header' : 'test-value' } ,
@@ -384,7 +384,7 @@ describe('instantiate client', () => {
384384 // Test inherited options remain the same
385385 expect ( newClient . buildURL ( '/foo' , null ) ) . toEqual ( 'http://localhost:5001/foo?test-param=test-value' ) ;
386386
387- const { req } = newClient . buildRequest ( { path : '/foo' , method : 'get' } ) ;
387+ const { req } = await newClient . buildRequest ( { path : '/foo' , method : 'get' } ) ;
388388 expect ( req . headers . get ( 'x-test-header' ) ) . toEqual ( 'test-value' ) ;
389389 } ) ;
390390
@@ -434,8 +434,8 @@ describe('request building', () => {
434434 const client = new Flowglad ( { apiKey : 'My API Key' } ) ;
435435
436436 describe ( 'custom headers' , ( ) => {
437- test ( 'handles undefined' , ( ) => {
438- const { req } = client . buildRequest ( {
437+ test ( 'handles undefined' , async ( ) => {
438+ const { req } = await client . buildRequest ( {
439439 path : '/foo' ,
440440 method : 'post' ,
441441 body : { value : 'hello' } ,
@@ -470,8 +470,8 @@ describe('default encoder', () => {
470470 }
471471 }
472472 for ( const jsonValue of [ { } , [ ] , { __proto__ : null } , new Serializable ( ) , new Collection ( [ 'item' ] ) ] ) {
473- test ( `serializes ${ util . inspect ( jsonValue ) } as json` , ( ) => {
474- const { req } = client . buildRequest ( {
473+ test ( `serializes ${ util . inspect ( jsonValue ) } as json` , async ( ) => {
474+ const { req } = await client . buildRequest ( {
475475 path : '/foo' ,
476476 method : 'post' ,
477477 body : jsonValue ,
@@ -494,7 +494,7 @@ describe('default encoder', () => {
494494 asyncIterable ,
495495 ] ) {
496496 test ( `converts ${ util . inspect ( streamValue ) } to ReadableStream` , async ( ) => {
497- const { req } = client . buildRequest ( {
497+ const { req } = await client . buildRequest ( {
498498 path : '/foo' ,
499499 method : 'post' ,
500500 body : streamValue ,
@@ -507,7 +507,7 @@ describe('default encoder', () => {
507507 }
508508
509509 test ( `can set content-type for ReadableStream` , async ( ) => {
510- const { req } = client . buildRequest ( {
510+ const { req } = await client . buildRequest ( {
511511 path : '/foo' ,
512512 method : 'post' ,
513513 body : new Response ( 'a\nb\nc\n' ) . body ,
0 commit comments