Skip to content

Commit 79ba94b

Browse files
authored
test(jest): set timezone for stable snapshots (#2443)
* test(jest): set timezone for stable snapshots Signed-off-by: Adam Setch <[email protected]> * test(jest): set timezone for stable snapshots Signed-off-by: Adam Setch <[email protected]> * test(jest): set timezone for stable snapshots Signed-off-by: Adam Setch <[email protected]> --------- Signed-off-by: Adam Setch <[email protected]>
1 parent f782b4d commit 79ba94b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Config } from 'jest';
22

33
const config: Config = {
44
preset: 'ts-jest',
5+
globalSetup: '<rootDir>/src/renderer/__helpers__/jest.setup.env.ts',
56
setupFilesAfterEnv: ['<rootDir>/src/renderer/__helpers__/jest.setup.ts'],
67
testEnvironment: 'jsdom',
78
collectCoverage: true,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Jest Global Setup
3+
* This runs once before all test suites
4+
*/
5+
export default () => {
6+
// Sets timezone to UTC for consistent date/time in tests and snapshots
7+
process.env.TZ = 'UTC';
8+
};

src/renderer/__helpers__/jest.setup.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ window.gitify = {
4545
raiseNativeNotification: jest.fn(),
4646
};
4747

48-
// Mock OAuth client ID and secret
49-
process.env.OAUTH_CLIENT_ID = 'FAKE_CLIENT_ID_123';
50-
process.env.OAUTH_CLIENT_SECRET = 'FAKE_CLIENT_SECRET_123';
51-
5248
globalThis.HTMLMediaElement.prototype.play = jest.fn();
5349

5450
globalThis.matchMedia = (query: string): MediaQueryList => ({

0 commit comments

Comments
 (0)