@@ -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 } ,
@@ -344,7 +344,7 @@ describe('instantiate client', () => {
344344 } ) ;
345345
346346 describe ( 'withOptions' , ( ) => {
347- test ( 'creates a new client with overridden options' , ( ) => {
347+ test ( 'creates a new client with overridden options' , async ( ) => {
348348 const client = new Isaacus ( { baseURL : 'http://localhost:5000/' , maxRetries : 3 , apiKey : 'My API Key' } ) ;
349349
350350 const newClient = client . withOptions ( {
@@ -365,7 +365,7 @@ describe('instantiate client', () => {
365365 expect ( newClient . constructor ) . toBe ( client . constructor ) ;
366366 } ) ;
367367
368- test ( 'inherits options from the parent client' , ( ) => {
368+ test ( 'inherits options from the parent client' , async ( ) => {
369369 const client = new Isaacus ( {
370370 baseURL : 'http://localhost:5000/' ,
371371 defaultHeaders : { 'X-Test-Header' : 'test-value' } ,
@@ -380,7 +380,7 @@ describe('instantiate client', () => {
380380 // Test inherited options remain the same
381381 expect ( newClient . buildURL ( '/foo' , null ) ) . toEqual ( 'http://localhost:5001/foo?test-param=test-value' ) ;
382382
383- const { req } = newClient . buildRequest ( { path : '/foo' , method : 'get' } ) ;
383+ const { req } = await newClient . buildRequest ( { path : '/foo' , method : 'get' } ) ;
384384 expect ( req . headers . get ( 'x-test-header' ) ) . toEqual ( 'test-value' ) ;
385385 } ) ;
386386
@@ -430,8 +430,8 @@ describe('request building', () => {
430430 const client = new Isaacus ( { apiKey : 'My API Key' } ) ;
431431
432432 describe ( 'custom headers' , ( ) => {
433- test ( 'handles undefined' , ( ) => {
434- const { req } = client . buildRequest ( {
433+ test ( 'handles undefined' , async ( ) => {
434+ const { req } = await client . buildRequest ( {
435435 path : '/foo' ,
436436 method : 'post' ,
437437 body : { value : 'hello' } ,
@@ -466,8 +466,8 @@ describe('default encoder', () => {
466466 }
467467 }
468468 for ( const jsonValue of [ { } , [ ] , { __proto__ : null } , new Serializable ( ) , new Collection ( [ 'item' ] ) ] ) {
469- test ( `serializes ${ util . inspect ( jsonValue ) } as json` , ( ) => {
470- const { req } = client . buildRequest ( {
469+ test ( `serializes ${ util . inspect ( jsonValue ) } as json` , async ( ) => {
470+ const { req } = await client . buildRequest ( {
471471 path : '/foo' ,
472472 method : 'post' ,
473473 body : jsonValue ,
@@ -490,7 +490,7 @@ describe('default encoder', () => {
490490 asyncIterable ,
491491 ] ) {
492492 test ( `converts ${ util . inspect ( streamValue ) } to ReadableStream` , async ( ) => {
493- const { req } = client . buildRequest ( {
493+ const { req } = await client . buildRequest ( {
494494 path : '/foo' ,
495495 method : 'post' ,
496496 body : streamValue ,
@@ -503,7 +503,7 @@ describe('default encoder', () => {
503503 }
504504
505505 test ( `can set content-type for ReadableStream` , async ( ) => {
506- const { req } = client . buildRequest ( {
506+ const { req } = await client . buildRequest ( {
507507 path : '/foo' ,
508508 method : 'post' ,
509509 body : new Response ( 'a\nb\nc\n' ) . body ,
0 commit comments