Skip to content

Commit

Permalink
update date mock to use UTC (+0) code to align with gitaction timezon…
Browse files Browse the repository at this point in the history
…e environment and set the system time using this mock
  • Loading branch information
harley-harris committed Dec 13, 2023
1 parent cde1d6f commit 49c494f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/mock/text.mock.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const MOCK_NAMESPACE = 'namespace';
export const MOCK_DATE = '1970-01-01 01:00:00.000+1';
export const MOCK_DATE = '1999-01-01 00:00:00.000+0';
4 changes: 2 additions & 2 deletions test/unit/formatting/humanFormat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import winston from 'winston';

import * as humanFormat from '../../../src/formatting/humanFormat';
import { MOCK_INFO, MOCK_HUMAN_MESSAGE, MOCK_FORMATTED_HUMAN_MESSAGE } from '../../mock/data.mock';
import { MOCK_NAMESPACE } from '../../mock/text.mock';
import { MOCK_DATE, MOCK_NAMESPACE } from '../../mock/text.mock';

describe('humanFormat test suites', () => {
afterEach(() => {
Expand All @@ -12,7 +12,7 @@ describe('humanFormat test suites', () => {

describe('setHumanMessage test', () => {
beforeEach(() => {
jest.useFakeTimers().setSystemTime();
jest.useFakeTimers().setSystemTime(new Date(MOCK_DATE));
});

afterEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/formatting/jsonFormat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import winston from 'winston';
import * as jsonFormat from '../../../src/formatting/jsonFormat';

import { MOCK_INFO, MOCK_JSON_OBJECT, MOCK_JSON_STRINGIFIED } from '../../mock/data.mock';
import { MOCK_NAMESPACE } from '../../mock/text.mock';
import { MOCK_DATE, MOCK_NAMESPACE } from '../../mock/text.mock';

describe('jsonFormat test suites', () => {
afterEach(() => {
Expand All @@ -13,7 +13,7 @@ describe('jsonFormat test suites', () => {

describe('setJsonMessage Test', () => {
beforeEach(() => {
jest.useFakeTimers().setSystemTime();
jest.useFakeTimers().setSystemTime(new Date(MOCK_DATE));
});
afterEach(() => {
jest.useRealTimers();
Expand Down

0 comments on commit 49c494f

Please sign in to comment.