Skip to content

Build your personal knowledge base with Trilium Notes

test(server): fake timers not restored

Elian Dorandb0c515bade7
diff --git a/apps/server/src/routes/login.spec.ts b/apps/server/src/routes/login.spec.ts
index 0f210bfdc1..e6c7131ed0 100644
--- a/apps/server/src/routes/login.spec.ts
+++ b/apps/server/src/routes/login.spec.ts
@@ -2,7 +2,7 @@ import { dayjs } from "@triliumnext/commons";
import type { Application } from "express";
import { SessionData } from "express-session";
import supertest, { type Response } from "supertest";
-import { beforeAll, describe, expect, it, vi } from "vitest";
+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import cls from "../services/cls.js";
import { type SQLiteSessionStore } from "./session_parser.js";
@@ -20,6 +20,10 @@ describe("Login Route test", () => {
({ sessionStore, CLEAN_UP_INTERVAL } = (await import("./session_parser.js")));
});
+ afterAll(() => {
+ vi.useRealTimers();
+ });
+
it("should return the login page, when using a GET request", async () => {
// RegExp for login page specific string in HTML
diff --git a/apps/server/src/share/routes.spec.ts b/apps/server/src/share/routes.spec.ts
index a920a3620d..f4ce2c1736 100644
--- a/apps/server/src/share/routes.spec.ts
+++ b/apps/server/src/share/routes.spec.ts
@@ -1,6 +1,6 @@
import type { Application, NextFunction,Request, Response } from "express";
import supertest from "supertest";
-import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
+import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { safeExtractMessageAndStackFromError } from "../services/utils.js";
@@ -23,6 +23,10 @@ describe("Share API test", () => {
});
});
+ afterAll(() => {
+ vi.useRealTimers();
+ });
+
beforeEach(() => {
cannotSetHeadersCount = 0;
});