Skip to content

Commit 6ccd3d4

Browse files
committed
fix(backend): fix unit test
1 parent 38a03d9 commit 6ccd3d4

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

packages/backend/src/modules/stats/controllers/stats.private.controller.security-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export const StatsPrivateControllerSecurityTests: AppTestHttpClientSecurityTestD
2424
response: await AppTestHttpClient.post("/stats", {
2525
context,
2626
body: {
27-
start: new Date("2021-03-31T14:32:22Z"),
28-
end: new Date("2021-04-31T14:32:22Z"),
27+
startDate: new Date("2021-03-31T14:32:22Z"),
28+
endDate: new Date("2021-04-31T14:32:22Z"),
2929
structureId,
3030
},
3131
}),

packages/backend/src/modules/stats/services/tests/structureStatsInPeriodGenerator.service.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,18 @@ describe("structureStatsInPeriodGenerator", () => {
1010
});
1111

1212
it("buildStatsInPeriod", async () => {
13-
const startDateUTC = new Date(Date.UTC(2019, 10, 15));
14-
const endDateUTC = new Date(Date.UTC(2021, 1, 1));
15-
const endDateUTCExclusive = new Date(Date.UTC(2021, 1, 2));
13+
const startDate = "2019-10-15";
14+
const endDate = "2021-01-01";
1615

1716
const stats = await structureStatsInPeriodGenerator.buildStatsInPeriod({
1817
structureId: 1,
19-
startDateUTC,
20-
endDateUTCExclusive,
18+
startDate,
19+
endDate,
2120
});
2221

2322
expect(stats.structure.id).toEqual(1);
24-
expect(stats.period.startDateUTC).toEqual(startDateUTC);
25-
expect(stats.period.endDateUTC).toEqual(endDateUTC);
26-
expect(stats.period.endDateUTCExclusive).toEqual(endDateUTCExclusive);
23+
expect(stats.period.startDateUTC).toEqual(startDate);
24+
expect(stats.period.endDateUTC).toEqual(endDate);
2725
expect(stats).toBeDefined();
2826

2927
expect(stats.data).toEqual({

0 commit comments

Comments
 (0)