Skip to content

Commit 0ff650a

Browse files
committed
chore: Prettier
1 parent 656a226 commit 0ff650a

File tree

5 files changed

+26
-36
lines changed

5 files changed

+26
-36
lines changed

app/src/api/report.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { ReportAdapter } from '@/adapters/ReportAdapter';
12
import { BASE_URL } from '@/constants';
23
import { countryIds } from '@/libs/countries';
4+
import { Report } from '@/types/ingredients/Report';
35
import { ReportMetadata } from '@/types/metadata/reportMetadata';
46
import { ReportCreationPayload, ReportSetOutputPayload } from '@/types/payloads';
5-
import { ReportAdapter } from '@/adapters/ReportAdapter';
6-
import { Report } from '@/types/ingredients/Report';
77

88
export async function fetchReportById(
99
countryId: (typeof countryIds)[number],
@@ -15,7 +15,7 @@ export async function fetchReportById(
1515
method: 'GET',
1616
headers: {
1717
'Content-Type': 'application/json',
18-
'Accept': 'application/json',
18+
Accept: 'application/json',
1919
},
2020
});
2121

@@ -45,7 +45,6 @@ export async function createReport(
4545

4646
const json = await res.json();
4747
return json.result;
48-
4948
}
5049

5150
async function updateReport(

app/src/tests/adapters/ReportAdapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { describe, expect, test } from 'vitest';
22
import { ReportAdapter } from '@/adapters/ReportAdapter';
3-
import { Report } from '@/types/ingredients/Report';
43
import {
54
mockCompletedReportPayload,
65
mockErrorReport,
@@ -12,6 +11,7 @@ import {
1211
mockReportMetadataSingleSimulation,
1312
mockReportOutput,
1413
} from '@/tests/fixtures/adapters/reportMocks';
14+
import { Report } from '@/types/ingredients/Report';
1515

1616
describe('ReportAdapter', () => {
1717
describe('fromMetadata', () => {

app/src/tests/unit/api/report.test.ts

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { createReport, fetchReportById, markReportCompleted, markReportError } f
33
import { BASE_URL } from '@/constants';
44
import {
55
mockCompletedReportPayload,
6-
mockReportCreationPayload,
7-
mockReportMetadata,
6+
mockErrorReport,
87
mockErrorReportPayload,
98
mockReport,
10-
mockErrorReport,
9+
mockReportCreationPayload,
10+
mockReportMetadata,
1111
} from '@/tests/fixtures/adapters/reportMocks';
1212

1313
// Mock fetch globally
@@ -33,16 +33,13 @@ describe('report API', () => {
3333
const result = await fetchReportById(countryId, reportId);
3434

3535
// 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+
});
4643
expect(result).toEqual({
4744
...mockReportMetadata,
4845
id: String(mockReportMetadata.id),
@@ -121,14 +118,11 @@ describe('report API', () => {
121118
const result = await markReportCompleted(countryId, reportId, mockReport);
122119

123120
// 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+
});
132126
expect(result).toEqual({
133127
result: {
134128
...mockReportMetadata,
@@ -170,14 +164,11 @@ describe('report API', () => {
170164
const result = await markReportError(countryId, reportId, mockErrorReport);
171165

172166
// 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+
});
181172
expect(result).toEqual({
182173
result: {
183174
...mockReportMetadata,

app/src/types/ingredients/Report.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { countryIds } from "@/libs/countries";
1+
import { countryIds } from '@/libs/countries';
22

33
/**
44
* Placeholder for report output structure

app/src/types/metadata/reportMetadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { countryIds } from "@/libs/countries";
1+
import { countryIds } from '@/libs/countries';
22

33
export interface ReportMetadata {
44
id: number;

0 commit comments

Comments
 (0)