Skip to content

Commit

Permalink
CB-4551 all tests has UTC timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
s.teleshev committed Jan 22, 2024
1 parent 478ccd6 commit 87497cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion webapp/packages/core-cli/tests/test.environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ module.exports = class CustomTestEnvironment extends Environment {
this.global.TextDecoder = TextDecoder;
this.global.Response = Response;
this.global.Request = Request;

// different machine has its own timezones and some tests can fail because of it
process.env.TZ = 'UTC';
}
};
};
6 changes: 3 additions & 3 deletions webapp/packages/core-utils/src/timestampToDate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { timestampToDate } from './timestampToDate';
describe('timestampToDate', () => {
it('should convert timestamp to date', () => {
const date = timestampToDate(1591862400000);
expect(date).toBe('6/11/2020, 10:00:00 AM');
expect(date).toBe('6/11/2020, 8:00:00 AM');
});

it('should convert negative timestamp to date', () => {
const date = timestampToDate(-1591862400000);
expect(date).toBe('7/23/1919, 5:00:00 PM');
expect(date).toBe('7/23/1919, 4:00:00 PM');
});

it('should convert zero timestamp to date', () => {
const date = timestampToDate(0);
expect(date).toBe('1/1/1970, 1:00:00 AM');
expect(date).toBe('1/1/1970, 12:00:00 AM');
});
});

0 comments on commit 87497cf

Please sign in to comment.