Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 4a4c34e

Browse files
committed
fix(test): some etapi tests failing
1 parent cecbe58 commit 4a4c34e

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

apps/server/spec/etapi/create-backup.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ describe("etapi/backup", () => {
2121
const response = await supertest(app)
2222
.put("/etapi/backup/etapi_test")
2323
.auth(USER, token, { "type": "basic"})
24-
.expect(201);
24+
.expect(204);
2525
});
2626
});

apps/server/spec/etapi/get-date-notes.spec.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import config from "../../src/services/config.js";
33
import { login } from "./utils.js";
44
import { Application } from "express";
55
import supertest from "supertest";
6+
import date_notes from "../../src/services/date_notes.js";
7+
import cls from "../../src/services/cls.js";
68

79
let app: Application;
810
let token: string;
@@ -42,9 +44,16 @@ describe("etapi/get-date-notes", () => {
4244
});
4345

4446
describe("weeks", () => {
47+
beforeAll(() => {
48+
cls.init(() => {
49+
const rootCalendarNote = date_notes.getRootCalendarNote();
50+
rootCalendarNote.setLabel("enableWeekNote");
51+
});
52+
});
53+
4554
it("obtains week calendar", async () => {
4655
await supertest(app)
47-
.get("/etapi/calendar/weeks/2022-01-01")
56+
.get("/etapi/calendar/weeks/2022-W01")
4857
.auth(USER, token, { "type": "basic"})
4958
.expect(200);
5059
});
@@ -54,14 +63,14 @@ describe("etapi/get-date-notes", () => {
5463
.get("/etapi/calendar/weeks/2022-1")
5564
.auth(USER, token, { "type": "basic"})
5665
.expect(400);
57-
expect(response.body.code).toStrictEqual("DATE_INVALID");
66+
expect(response.body.code).toStrictEqual("WEEK_INVALID");
5867
});
5968
});
6069

6170
describe("months", () => {
6271
it("obtains month calendar", async () => {
6372
await supertest(app)
64-
.get("/etapi/calendar/weeks/2022-01")
73+
.get("/etapi/calendar/months/2022-01")
6574
.auth(USER, token, { "type": "basic"})
6675
.expect(200);
6776
});

apps/server/spec/etapi/other.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ describe("etapi/refresh-note-ordering/root", () => {
2121
await supertest(app)
2222
.post("/etapi/refresh-note-ordering/root")
2323
.auth(USER, token, { "type": "basic"})
24-
.expect(200);
24+
.expect(204);
2525
});
2626
});

0 commit comments

Comments
 (0)