Skip to content

Commit af8d6d8

Browse files
committed
test(calendar-web): update test with timezone set to UTC
1 parent e45f6cd commit af8d6d8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/pluggableWidgets/calendar-web/src/__tests__/Calendar.spec.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ import { ListValueBuilder } from "@mendix/widget-plugin-test-utils";
44

55
import Calendar from "../Calendar";
66
import { CalendarContainerProps } from "../../typings/CalendarProps";
7+
8+
// We capture any existing value, switch to UTC, and restore the original value
9+
// when the suite finishes.
10+
11+
const ORIGINAL_TZ = process.env.TZ;
12+
process.env.TZ = "UTC";
13+
714
const customViewProps: CalendarContainerProps = {
815
name: "calendar-test",
916
class: "calendar-class",
@@ -49,6 +56,10 @@ beforeAll(() => {
4956

5057
afterAll(() => {
5158
jest.useRealTimers();
59+
60+
// Restore whatever time-zone the process was originally using so other
61+
// test files are unaffected.
62+
process.env.TZ = ORIGINAL_TZ;
5263
});
5364

5465
describe("Calendar", () => {

0 commit comments

Comments
 (0)