test: restore TZ after pinning it in forward-as-attachment tests
Setting process.env.TZ at module scope without restoring it could leak into other test files sharing the same Vitest worker. Match the beforeAll/afterAll restore pattern already used in lib/__tests__/calendar-utils.test.ts.
This commit is contained in:
@@ -1,10 +1,18 @@
|
|||||||
// Pin TZ so the local-time date rendering in the filename test is deterministic.
|
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
||||||
process.env.TZ = 'UTC';
|
|
||||||
|
|
||||||
import { describe, it, expect } from 'vitest';
|
|
||||||
import { buildForwardAsAttachmentPayload } from '@/lib/forward-as-attachment';
|
import { buildForwardAsAttachmentPayload } from '@/lib/forward-as-attachment';
|
||||||
import type { Email } from '@/lib/jmap/types';
|
import type { Email } from '@/lib/jmap/types';
|
||||||
|
|
||||||
|
// Pin TZ so the local-time date rendering in the filename test is deterministic,
|
||||||
|
// restoring it after so this doesn't leak into other test files in the same worker.
|
||||||
|
let originalTZ: string | undefined;
|
||||||
|
beforeAll(() => {
|
||||||
|
originalTZ = process.env.TZ;
|
||||||
|
process.env.TZ = 'UTC';
|
||||||
|
});
|
||||||
|
afterAll(() => {
|
||||||
|
process.env.TZ = originalTZ;
|
||||||
|
});
|
||||||
|
|
||||||
function makeEmail(overrides: Partial<Email> = {}): Email {
|
function makeEmail(overrides: Partial<Email> = {}): Email {
|
||||||
return {
|
return {
|
||||||
id: 'e1',
|
id: 'e1',
|
||||||
|
|||||||
Reference in New Issue
Block a user