@@ -20,7 +20,6 @@ import type { Request as ReleaseRequest } from '@balena/compose/dist/release';
2020import  {  expect  }  from  'chai' ; 
2121import  {  promises  as  fs  }  from  'fs' ; 
2222import  *  as  _  from  'lodash' ; 
23- import  type  *  as  nock  from  'nock' ; 
2423import  *  as  path  from  'path' ; 
2524import  *  as  sinon  from  'sinon' ; 
2625
@@ -181,8 +180,8 @@ describe('balena deploy', function () {
181180		] ; 
182181
183182		api . expectPostRelease ( { 
184- 			inspectRequest : ( _uri :  string ,   requestBody :  nock . Body )  =>  { 
185- 				const  body  =  requestBody . valueOf ( )  as  Partial < ReleaseRequest > ; 
183+ 			inspectRequest : async   ( request :  Request )  =>  { 
184+ 				const  body  =  ( await   request . json ( ) )  as  Partial < ReleaseRequest > ; 
186185				expect ( body . contract ) . to . deep . equal ( { 
187186					name : 'testContract' , 
188187					type : 'sw.application' , 
@@ -232,8 +231,8 @@ describe('balena deploy', function () {
232231		] ; 
233232
234233		api . expectPostRelease ( { 
235- 			inspectRequest : ( _uri :  string ,   requestBody :  nock . Body )  =>  { 
236- 				const  body  =  requestBody . valueOf ( )  as  Partial < ReleaseRequest > ; 
234+ 			inspectRequest : async   ( request :  Request )  =>  { 
235+ 				const  body  =  ( await   request . json ( ) )  as  Partial < ReleaseRequest > ; 
237236				expect ( body . contract ) . to . deep . equal ( { 
238237					name : 'testContract' , 
239238					type : 'sw.application' , 
@@ -298,21 +297,21 @@ describe('balena deploy', function () {
298297			statusCode : 500 , 
299298			// b/c failed requests are retried 
300299			times : maxRequestRetries , 
301- 			inspectRequest : ( _uri ,   requestBody )  =>  { 
302- 				const  imageBody  =  requestBody  as  Partial < 
300+ 			inspectRequest : async   ( request :  Request )  =>  { 
301+ 				const  body  =  ( await   request . json ( ) )  as  Partial < 
303302					import ( '@balena/compose/dist/release/models' ) . ImageModel 
304303				> ; 
305- 				expect ( imageBody . status ) . to . equal ( 'success' ) ; 
304+ 				expect ( body . status ) . to . equal ( 'success' ) ; 
306305				failedImagePatchRequests ++ ; 
307306			} , 
308307		} ) ; 
309308		// Check that the CLI patches the release with status="failed" 
310309		api . expectPatchRelease ( { 
311- 			inspectRequest : ( _uri ,   requestBody )  =>  { 
312- 				const  releaseBody  =  requestBody  as  Partial < 
310+ 			inspectRequest : async   ( request :  Request )  =>  { 
311+ 				const  body  =  ( await   request . json ( ) )  as  Partial < 
313312					import ( '@balena/compose/dist/release/models' ) . ReleaseModel 
314313				> ; 
315- 				expect ( releaseBody . status ) . to . equal ( 'failed' ) ; 
314+ 				expect ( body . status ) . to . equal ( 'failed' ) ; 
316315			} , 
317316		} ) ; 
318317		api . expectPostImageLabel ( ) ; 
@@ -386,8 +385,8 @@ describe('balena deploy', function () {
386385		let  succesfullImagePatchRequests  =  0 ; 
387386		api 
388387			. optPatch ( / ^ \/ v 7 \/ i m a g e ( $ | [ ( ? ] ) / ,  {  times : maxRequestRetries  } ) 
389- 			. reply ( ( _uri ,   requestBody )  =>  { 
390- 				const  imageBody  =  requestBody  as  Partial < 
388+ 			. reply ( async   ( request )  =>  { 
389+ 				const  imageBody  =  ( await   request . json ( ) )  as  Partial < 
391390					import ( '@balena/compose/dist/release/models' ) . ImageModel 
392391				> ; 
393392				expect ( imageBody . status ) . to . equal ( 'success' ) ; 
0 commit comments