@@ -40,10 +40,7 @@ describe('report API', () => {
40
40
Accept : 'application/json' ,
41
41
} ,
42
42
} ) ;
43
- expect ( result ) . toEqual ( {
44
- ...mockReportMetadata ,
45
- id : String ( mockReportMetadata . id ) ,
46
- } ) ;
43
+ expect ( result ) . toEqual ( mockReportMetadata ) ;
47
44
} ) ;
48
45
49
46
test ( 'given API error then throws error' , async ( ) => {
@@ -68,7 +65,7 @@ describe('report API', () => {
68
65
// Given
69
66
const countryId = 'us' ;
70
67
const payload = mockReportCreationPayload ;
71
- const mockApiResponse = { result : { id : 123 } } ;
68
+ const mockApiResponse = { result : mockReportMetadata } ;
72
69
const mockResponse = {
73
70
ok : true ,
74
71
json : vi . fn ( ) . mockResolvedValue ( mockApiResponse ) ,
@@ -84,7 +81,7 @@ describe('report API', () => {
84
81
headers : { 'Content-Type' : 'application/json' } ,
85
82
body : JSON . stringify ( payload ) ,
86
83
} ) ;
87
- expect ( result ) . toEqual ( { result : { id : '123' } } ) ;
84
+ expect ( result ) . toEqual ( mockReportMetadata ) ;
88
85
} ) ;
89
86
90
87
test ( 'given API error then throws error' , async ( ) => {
@@ -118,17 +115,12 @@ describe('report API', () => {
118
115
const result = await markReportCompleted ( countryId , reportId , mockReport ) ;
119
116
120
117
// Then
121
- expect ( global . fetch ) . toHaveBeenCalledWith ( `${ BASE_URL } /${ countryId } /report/ ${ reportId } ` , {
118
+ expect ( global . fetch ) . toHaveBeenCalledWith ( `${ BASE_URL } /${ countryId } /report` , {
122
119
method : 'PATCH' ,
123
120
headers : { 'Content-Type' : 'application/json' } ,
124
121
body : JSON . stringify ( mockCompletedReportPayload ) ,
125
122
} ) ;
126
- expect ( result ) . toEqual ( {
127
- result : {
128
- ...mockReportMetadata ,
129
- id : String ( mockReportMetadata . id ) ,
130
- } ,
131
- } ) ;
123
+ expect ( result ) . toEqual ( mockReportMetadata ) ;
132
124
} ) ;
133
125
134
126
test ( 'given API error then throws error' , async ( ) => {
@@ -164,17 +156,12 @@ describe('report API', () => {
164
156
const result = await markReportError ( countryId , reportId , mockErrorReport ) ;
165
157
166
158
// Then
167
- expect ( global . fetch ) . toHaveBeenCalledWith ( `${ BASE_URL } /${ countryId } /report/ ${ reportId } ` , {
159
+ expect ( global . fetch ) . toHaveBeenCalledWith ( `${ BASE_URL } /${ countryId } /report` , {
168
160
method : 'PATCH' ,
169
161
headers : { 'Content-Type' : 'application/json' } ,
170
162
body : JSON . stringify ( mockErrorReportPayload ) ,
171
163
} ) ;
172
- expect ( result ) . toEqual ( {
173
- result : {
174
- ...mockReportMetadata ,
175
- id : String ( mockReportMetadata . id ) ,
176
- } ,
177
- } ) ;
164
+ expect ( result ) . toEqual ( mockReportMetadata ) ;
178
165
} ) ;
179
166
180
167
test ( 'given API error then throws error' , async ( ) => {
0 commit comments