From 7cfcade0ba33cee32fd16cd64ed82631ae367847 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 10:42:31 +0900 Subject: [PATCH] test: align popularity score tests with hour offset --- .../queues/tasks/UpdateDocumentsPopularityScoreTask.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/queues/tasks/UpdateDocumentsPopularityScoreTask.test.ts b/server/queues/tasks/UpdateDocumentsPopularityScoreTask.test.ts index 31cac930ad..5864d8b7f0 100644 --- a/server/queues/tasks/UpdateDocumentsPopularityScoreTask.test.ts +++ b/server/queues/tasks/UpdateDocumentsPopularityScoreTask.test.ts @@ -21,7 +21,7 @@ describe("UpdateDocumentsPopularityScoreTask", () => { beforeEach(() => { task = new UpdateDocumentsPopularityScoreTask(); - vi.spyOn(Date.prototype, "getHours").mockReturnValue(0); + vi.spyOn(Date.prototype, "getHours").mockReturnValue(6); // Ensure calculation query sees data created in tests by redirecting to main sequelize instance. // We only mock if the instances are different to avoid infinite recursion. @@ -303,7 +303,7 @@ describe("UpdateDocumentsPopularityScoreTask", () => { expect(Number(untouched?.popularityScore)).toBe(0); const onInterval = new Date(); - onInterval.setHours(0, 0, 0, 0); + onInterval.setHours(6, 0, 0, 0); await task.perform({ ...props, scheduledAt: onInterval.getTime() });