From 1907f13c5f509f28be5101354f870a67a578a5e2 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Mon, 12 Dec 2022 13:15:28 +0200 Subject: [PATCH] fix(site): Use relative date in Timeline test (#5377) --- site/src/components/Timeline/Timeline.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/site/src/components/Timeline/Timeline.test.tsx b/site/src/components/Timeline/Timeline.test.tsx index 6edf7c8433..c17cc356f8 100644 --- a/site/src/components/Timeline/Timeline.test.tsx +++ b/site/src/components/Timeline/Timeline.test.tsx @@ -2,7 +2,13 @@ import { createDisplayDate } from "./TimelineDateRow" describe("createDisplayDate", () => { it("returns correctly for Saturdays", () => { - const date = new Date("Sat Dec 03 2022 00:00:00 GMT-0500") + const now = new Date() + const date = new Date( + now.getFullYear(), + now.getMonth(), + // Previous Saturday, from now. + now.getDate() - now.getDay() - 1, + ) expect(createDisplayDate(date)).toEqual("last Saturday") }) })