@@ -26,14 +26,16 @@ describe('api service', () => {
2626
2727 await apiService . get ( '/api/path' , token )
2828
29- expect ( requestMock ) . toHaveBeenCalledWith ( {
30- url : 'https://test.localhost/api/path' ,
31- method : 'get' ,
32- headers : {
33- 'Content-Type' : 'application/json' ,
34- 'Authorization' : `Bearer ${ token } `
35- }
36- } )
29+ expect ( requestMock ) . toHaveBeenCalledWith (
30+ expect . objectContaining ( {
31+ url : 'https://test.localhost/api/path' ,
32+ method : 'get' ,
33+ headers : {
34+ 'Content-Type' : 'application/json' ,
35+ 'Authorization' : `Bearer ${ token } `
36+ }
37+ } )
38+ )
3739 } )
3840
3941 test ( 'it returns statusCode, statusMessage, and body' , async ( ) => {
@@ -60,15 +62,17 @@ describe('api service', () => {
6062
6163 await apiService . post ( '/api/path' , data , token )
6264
63- expect ( requestMock ) . toHaveBeenCalledWith ( {
64- url : 'https://test.localhost/api/path' ,
65- method : 'post' ,
66- headers : {
67- 'Content-Type' : 'application/json' ,
68- 'Authorization' : `Bearer ${ token } `
69- } ,
70- data : JSON . stringify ( data ) ,
71- } )
65+ expect ( requestMock ) . toHaveBeenCalledWith (
66+ expect . objectContaining ( {
67+ url : 'https://test.localhost/api/path' ,
68+ method : 'post' ,
69+ headers : {
70+ 'Content-Type' : 'application/json' ,
71+ 'Authorization' : `Bearer ${ token } `
72+ } ,
73+ data : JSON . stringify ( data ) ,
74+ } )
75+ )
7276 } )
7377
7478 test ( 'it returns statusCode, statusMessage, and body' , async ( ) => {
@@ -77,15 +81,17 @@ describe('api service', () => {
7781
7882 const response = await apiService . post ( '/api/path' , data )
7983
80- expect ( requestMock ) . toHaveBeenCalledWith ( {
81- url : 'https://test.localhost/api/path' ,
82- method : 'post' ,
83- headers : {
84- 'Content-Type' : 'application/json' ,
85- 'Authorization' : `Bearer ${ token } `
86- } ,
87- data : JSON . stringify ( data ) ,
88- } )
84+ expect ( requestMock ) . toHaveBeenCalledWith (
85+ expect . objectContaining ( {
86+ url : 'https://test.localhost/api/path' ,
87+ method : 'post' ,
88+ headers : {
89+ 'Content-Type' : 'application/json' ,
90+ 'Authorization' : `Bearer ${ token } `
91+ } ,
92+ data : JSON . stringify ( data ) ,
93+ } )
94+ )
8995 } )
9096 } )
9197} )
0 commit comments