From 83f06ee90efdb17fd83795e91a7d6f84c38ae9e1 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Mon, 9 Dec 2024 14:05:33 -0500 Subject: [PATCH] Try setting tz just for the specific dates jest tests --- client/src/utils/dates.test.ts | 8 ++++++++ client/tests/jest/jest.setup.js | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/utils/dates.test.ts b/client/src/utils/dates.test.ts index 02583c03258e..2792bea0efec 100644 --- a/client/src/utils/dates.test.ts +++ b/client/src/utils/dates.test.ts @@ -1,6 +1,14 @@ import { formatGalaxyPrettyDateString, galaxyTimeToDate, localizeUTCPretty } from "./dates"; describe("dates.ts", () => { + beforeEach(() => { + process.env.TZ = "America/New_York"; + }); + + afterEach(() => { + delete process.env.TZ; + }); + describe("galaxyTimeToDate", () => { it("should convert valid galaxyTime string to Date object", () => { const galaxyTime = "2023-10-01T12:00:00"; diff --git a/client/tests/jest/jest.setup.js b/client/tests/jest/jest.setup.js index eb1f67ae1833..505e186fd517 100644 --- a/client/tests/jest/jest.setup.js +++ b/client/tests/jest/jest.setup.js @@ -12,9 +12,6 @@ Vue.config.devtools = false; and this makes the tag tests work correctly */ global.setImmediate = global.setTimeout; -// Consistent timezone for tests so we can compare date strings -process.env.TZ = "America/New_York"; - // Always mock the following imports jest.mock("@/composables/hashedUserId"); jest.mock("@/composables/userLocalStorage");