@@ -3,11 +3,11 @@ import { createReport, fetchReportById, markReportCompleted, markReportError } f
3
3
import { BASE_URL } from '@/constants' ;
4
4
import {
5
5
mockCompletedReportPayload ,
6
- mockReportCreationPayload ,
7
- mockReportMetadata ,
6
+ mockErrorReport ,
8
7
mockErrorReportPayload ,
9
8
mockReport ,
10
- mockErrorReport ,
9
+ mockReportCreationPayload ,
10
+ mockReportMetadata ,
11
11
} from '@/tests/fixtures/adapters/reportMocks' ;
12
12
13
13
// Mock fetch globally
@@ -33,16 +33,13 @@ describe('report API', () => {
33
33
const result = await fetchReportById ( countryId , reportId ) ;
34
34
35
35
// Then
36
- expect ( global . fetch ) . toHaveBeenCalledWith (
37
- `${ BASE_URL } /${ countryId } /report/${ reportId } ` ,
38
- {
39
- method : 'GET' ,
40
- headers : {
41
- 'Content-Type' : 'application/json' ,
42
- 'Accept' : 'application/json' ,
43
- } ,
44
- }
45
- ) ;
36
+ expect ( global . fetch ) . toHaveBeenCalledWith ( `${ BASE_URL } /${ countryId } /report/${ reportId } ` , {
37
+ method : 'GET' ,
38
+ headers : {
39
+ 'Content-Type' : 'application/json' ,
40
+ Accept : 'application/json' ,
41
+ } ,
42
+ } ) ;
46
43
expect ( result ) . toEqual ( {
47
44
...mockReportMetadata ,
48
45
id : String ( mockReportMetadata . id ) ,
@@ -121,14 +118,11 @@ describe('report API', () => {
121
118
const result = await markReportCompleted ( countryId , reportId , mockReport ) ;
122
119
123
120
// Then
124
- expect ( global . fetch ) . toHaveBeenCalledWith (
125
- `${ BASE_URL } /${ countryId } /report/${ reportId } ` ,
126
- {
127
- method : 'PATCH' ,
128
- headers : { 'Content-Type' : 'application/json' } ,
129
- body : JSON . stringify ( mockCompletedReportPayload ) ,
130
- }
131
- ) ;
121
+ expect ( global . fetch ) . toHaveBeenCalledWith ( `${ BASE_URL } /${ countryId } /report/${ reportId } ` , {
122
+ method : 'PATCH' ,
123
+ headers : { 'Content-Type' : 'application/json' } ,
124
+ body : JSON . stringify ( mockCompletedReportPayload ) ,
125
+ } ) ;
132
126
expect ( result ) . toEqual ( {
133
127
result : {
134
128
...mockReportMetadata ,
@@ -170,14 +164,11 @@ describe('report API', () => {
170
164
const result = await markReportError ( countryId , reportId , mockErrorReport ) ;
171
165
172
166
// Then
173
- expect ( global . fetch ) . toHaveBeenCalledWith (
174
- `${ BASE_URL } /${ countryId } /report/${ reportId } ` ,
175
- {
176
- method : 'PATCH' ,
177
- headers : { 'Content-Type' : 'application/json' } ,
178
- body : JSON . stringify ( mockErrorReportPayload ) ,
179
- }
180
- ) ;
167
+ expect ( global . fetch ) . toHaveBeenCalledWith ( `${ BASE_URL } /${ countryId } /report/${ reportId } ` , {
168
+ method : 'PATCH' ,
169
+ headers : { 'Content-Type' : 'application/json' } ,
170
+ body : JSON . stringify ( mockErrorReportPayload ) ,
171
+ } ) ;
181
172
expect ( result ) . toEqual ( {
182
173
result : {
183
174
...mockReportMetadata ,
0 commit comments