mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Set timezone for tests to non utc. (#28405)
* Set timezone for tests to non utc. * Fix comment
This commit is contained in:
parent
0bfdf79968
commit
4169646c84
@ -1,4 +1,7 @@
|
||||
process.env.TZ = 'UTC';
|
||||
// We set this specifically for 2 reasons.
|
||||
// 1. It makes sense for both CI tests and local tests to behave the same so issues are found earlier
|
||||
// 2. Any wrong timezone handling could be hidden if we use UTC/GMT local time (which would happen in CI).
|
||||
process.env.TZ = 'Pacific/Easter';
|
||||
|
||||
module.exports = {
|
||||
verbose: false,
|
||||
|
@ -2,28 +2,25 @@ import { getTimeZoneInfo } from './timezones';
|
||||
import { setTimeZoneResolver } from './common';
|
||||
|
||||
describe('getTimeZoneInfo', () => {
|
||||
// global timezone is set to UTC, see jest-config.js file
|
||||
// global timezone is set to Pacific/Easter, see jest-config.js file
|
||||
|
||||
describe('IANA canonical name of the timezone', () => {
|
||||
it('should resolve for default timezone', () => {
|
||||
setTimeZoneResolver(() => 'browser');
|
||||
const result = getTimeZoneInfo('', Date.now());
|
||||
expect(result?.ianaName).toBe('Africa/Abidjan');
|
||||
expect(result?.ianaName).toBe('Pacific/Easter');
|
||||
});
|
||||
|
||||
it('should resolve for browser timezone', () => {
|
||||
// global timezone is set to UTC
|
||||
const result = getTimeZoneInfo('browser', Date.now());
|
||||
expect(result?.ianaName).toBe('Africa/Abidjan');
|
||||
expect(result?.ianaName).toBe('Pacific/Easter');
|
||||
});
|
||||
it('should resolve for utc timezone', () => {
|
||||
// global timezone is set to UTC
|
||||
const result = getTimeZoneInfo('utc', Date.now());
|
||||
expect(result?.ianaName).toBe('UTC');
|
||||
});
|
||||
|
||||
it('should resolve for given timezone', () => {
|
||||
// global timezone is set to UTC
|
||||
const result = getTimeZoneInfo('Europe/Warsaw', Date.now());
|
||||
expect(result?.ianaName).toBe('Europe/Warsaw');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user