@@ -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 } ,
@@ -361,7 +361,7 @@ describe('instantiate client', () => {
361361 } ) ;
362362
363363 describe ( 'withOptions' , ( ) => {
364- test ( 'creates a new client with overridden options' , ( ) => {
364+ test ( 'creates a new client with overridden options' , async ( ) => {
365365 const client = new CasParser ( {
366366 baseURL : 'http://localhost:5000/' ,
367367 maxRetries : 3 ,
@@ -386,7 +386,7 @@ describe('instantiate client', () => {
386386 expect ( newClient . constructor ) . toBe ( client . constructor ) ;
387387 } ) ;
388388
389- test ( 'inherits options from the parent client' , ( ) => {
389+ test ( 'inherits options from the parent client' , async ( ) => {
390390 const client = new CasParser ( {
391391 baseURL : 'http://localhost:5000/' ,
392392 defaultHeaders : { 'X-Test-Header' : 'test-value' } ,
@@ -401,7 +401,7 @@ describe('instantiate client', () => {
401401 // Test inherited options remain the same
402402 expect ( newClient . buildURL ( '/foo' , null ) ) . toEqual ( 'http://localhost:5001/foo?test-param=test-value' ) ;
403403
404- const { req } = newClient . buildRequest ( { path : '/foo' , method : 'get' } ) ;
404+ const { req } = await newClient . buildRequest ( { path : '/foo' , method : 'get' } ) ;
405405 expect ( req . headers . get ( 'x-test-header' ) ) . toEqual ( 'test-value' ) ;
406406 } ) ;
407407
@@ -455,8 +455,8 @@ describe('request building', () => {
455455 const client = new CasParser ( { apiKey : 'My API Key' } ) ;
456456
457457 describe ( 'custom headers' , ( ) => {
458- test ( 'handles undefined' , ( ) => {
459- const { req } = client . buildRequest ( {
458+ test ( 'handles undefined' , async ( ) => {
459+ const { req } = await client . buildRequest ( {
460460 path : '/foo' ,
461461 method : 'post' ,
462462 body : { value : 'hello' } ,
@@ -491,8 +491,8 @@ describe('default encoder', () => {
491491 }
492492 }
493493 for ( const jsonValue of [ { } , [ ] , { __proto__ : null } , new Serializable ( ) , new Collection ( [ 'item' ] ) ] ) {
494- test ( `serializes ${ util . inspect ( jsonValue ) } as json` , ( ) => {
495- const { req } = client . buildRequest ( {
494+ test ( `serializes ${ util . inspect ( jsonValue ) } as json` , async ( ) => {
495+ const { req } = await client . buildRequest ( {
496496 path : '/foo' ,
497497 method : 'post' ,
498498 body : jsonValue ,
@@ -515,7 +515,7 @@ describe('default encoder', () => {
515515 asyncIterable ,
516516 ] ) {
517517 test ( `converts ${ util . inspect ( streamValue ) } to ReadableStream` , async ( ) => {
518- const { req } = client . buildRequest ( {
518+ const { req } = await client . buildRequest ( {
519519 path : '/foo' ,
520520 method : 'post' ,
521521 body : streamValue ,
@@ -528,7 +528,7 @@ describe('default encoder', () => {
528528 }
529529
530530 test ( `can set content-type for ReadableStream` , async ( ) => {
531- const { req } = client . buildRequest ( {
531+ const { req } = await client . buildRequest ( {
532532 path : '/foo' ,
533533 method : 'post' ,
534534 body : new Response ( 'a\nb\nc\n' ) . body ,
0 commit comments