@@ -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 } ,
@@ -357,7 +357,7 @@ describe('instantiate client', () => {
357357 } ) ;
358358
359359 describe ( 'withOptions' , ( ) => {
360- test ( 'creates a new client with overridden options' , ( ) => {
360+ test ( 'creates a new client with overridden options' , async ( ) => {
361361 const client = new Kernel ( { baseURL : 'http://localhost:5000/' , maxRetries : 3 , apiKey : 'My API Key' } ) ;
362362
363363 const newClient = client . withOptions ( {
@@ -378,7 +378,7 @@ describe('instantiate client', () => {
378378 expect ( newClient . constructor ) . toBe ( client . constructor ) ;
379379 } ) ;
380380
381- test ( 'inherits options from the parent client' , ( ) => {
381+ test ( 'inherits options from the parent client' , async ( ) => {
382382 const client = new Kernel ( {
383383 baseURL : 'http://localhost:5000/' ,
384384 defaultHeaders : { 'X-Test-Header' : 'test-value' } ,
@@ -393,7 +393,7 @@ describe('instantiate client', () => {
393393 // Test inherited options remain the same
394394 expect ( newClient . buildURL ( '/foo' , null ) ) . toEqual ( 'http://localhost:5001/foo?test-param=test-value' ) ;
395395
396- const { req } = newClient . buildRequest ( { path : '/foo' , method : 'get' } ) ;
396+ const { req } = await newClient . buildRequest ( { path : '/foo' , method : 'get' } ) ;
397397 expect ( req . headers . get ( 'x-test-header' ) ) . toEqual ( 'test-value' ) ;
398398 } ) ;
399399
@@ -443,8 +443,8 @@ describe('request building', () => {
443443 const client = new Kernel ( { apiKey : 'My API Key' } ) ;
444444
445445 describe ( 'custom headers' , ( ) => {
446- test ( 'handles undefined' , ( ) => {
447- const { req } = client . buildRequest ( {
446+ test ( 'handles undefined' , async ( ) => {
447+ const { req } = await client . buildRequest ( {
448448 path : '/foo' ,
449449 method : 'post' ,
450450 body : { value : 'hello' } ,
@@ -479,8 +479,8 @@ describe('default encoder', () => {
479479 }
480480 }
481481 for ( const jsonValue of [ { } , [ ] , { __proto__ : null } , new Serializable ( ) , new Collection ( [ 'item' ] ) ] ) {
482- test ( `serializes ${ util . inspect ( jsonValue ) } as json` , ( ) => {
483- const { req } = client . buildRequest ( {
482+ test ( `serializes ${ util . inspect ( jsonValue ) } as json` , async ( ) => {
483+ const { req } = await client . buildRequest ( {
484484 path : '/foo' ,
485485 method : 'post' ,
486486 body : jsonValue ,
@@ -503,7 +503,7 @@ describe('default encoder', () => {
503503 asyncIterable ,
504504 ] ) {
505505 test ( `converts ${ util . inspect ( streamValue ) } to ReadableStream` , async ( ) => {
506- const { req } = client . buildRequest ( {
506+ const { req } = await client . buildRequest ( {
507507 path : '/foo' ,
508508 method : 'post' ,
509509 body : streamValue ,
@@ -516,7 +516,7 @@ describe('default encoder', () => {
516516 }
517517
518518 test ( `can set content-type for ReadableStream` , async ( ) => {
519- const { req } = client . buildRequest ( {
519+ const { req } = await client . buildRequest ( {
520520 path : '/foo' ,
521521 method : 'post' ,
522522 body : new Response ( 'a\nb\nc\n' ) . body ,
0 commit comments