Skip to content

Commit

Permalink
Try setting tz just for the specific dates jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Dec 9, 2024
1 parent 96df005 commit 83f06ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 8 additions & 0 deletions client/src/utils/dates.test.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
3 changes: 0 additions & 3 deletions client/tests/jest/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

0 comments on commit 83f06ee

Please sign in to comment.