Skip to content

Commit c5e798e

Browse files
committed
vi.stubEnv
1 parent a6bc4cd commit c5e798e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/util.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { beforeEach, describe, expect, test } from "vitest";
1+
import { afterEach } from "node:test";
2+
import { beforeEach, describe, expect, test, vi } from "vitest";
23
import { delay } from "es-toolkit";
34
import {
45
addDays,
@@ -40,6 +41,14 @@ describe("enarray", () => {
4041
});
4142

4243
describe("formatDate", () => {
44+
beforeEach(() => {
45+
vi.stubEnv("TZ", "UTC+01:00");
46+
});
47+
48+
afterEach(() => {
49+
vi.unstubAllEnvs();
50+
});
51+
4352
test("formats a date", () => {
4453
// Date in UTC in winter
4554
const dateStrWinter = "2022-11-30T12:44:37Z";

0 commit comments

Comments
 (0)