Open
Description
Describe the bug
Running pnpm vitest
results in failures related to timezones.
To Reproduce
gh repo clone temporalio/ui
cd ui
pnpm install
pnpm test # passes green
pnpm vitest
Expected behavior
pass green
Desktop (please complete the following information):
- OS: macOS
- Browser: n/a
- Darwin Kernel Version 23.3.0
Additional context
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 11 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL src/lib/utilities/to-duration.test.ts > toDate > should produce a date based on a duration
AssertionError: expected '2019-10-02T23:00:00.000Z' to be '2019-10-03T00:00:00.000Z' // Object.is equality
- Expected
+ Received
- 2019-10-03T00:00:00.000Z
+ 2019-10-02T23:00:00.000Z
❯ src/lib/utilities/to-duration.test.ts:109:20
107|
108| const result = toDate({ days: 90 });
109| expect(result).toBe(ninetyDaysEarlier);
| ^
110| });
111|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/11]⎯
FAIL src/lib/utilities/to-duration.test.ts > toDate > should produce a date based on a duration string
AssertionError: expected '2019-10-02T23:00:00.000Z' to be '2019-10-03T00:00:00.000Z' // Object.is equality
- Expected
+ Received
- 2019-10-03T00:00:00.000Z
+ 2019-10-02T23:00:00.000Z
❯ src/lib/utilities/to-duration.test.ts:116:20
114|
115| const result = toDate('90 days');
116| expect(result).toBe(ninetyDaysEarlier);
| ^
117| });
118| });
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/11]⎯
FAIL src/lib/utilities/to-duration.test.ts > fromDate > should produce a duration based on a 90 days in the past
AssertionError: expected { Object (years, months, ...) } to match object { months: 2, days: 29 }
- Expected
+ Received
Object {
- "days": 29,
+ "days": 28,
+ "hours": 23,
+ "minutes": 0,
"months": 2,
+ "seconds": 0,
+ "years": 0,
}
❯ src/lib/utilities/to-duration.test.ts:160:20
158|
159| const result = fromDate(ninetyDaysEarlier);
160| expect(result).toMatchObject({ months: 2, days: 29 });
| ^
161| });
162|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/11]⎯
FAIL src/lib/utilities/to-duration.test.ts > fromDate > should produce a duration based on a 60 days in the past
AssertionError: expected { Object (years, months, ...) } to match object { months: 2 }
- Expected
+ Received
Object {
- "months": 2,
+ "days": 30,
+ "hours": 23,
+ "minutes": 0,
+ "months": 1,
+ "seconds": 0,
+ "years": 0,
}
❯ src/lib/utilities/to-duration.test.ts:167:20
165|
166| const result = fromDate(sixtyDaysEarlier);
167| expect(result).toMatchObject({ months: 2 });
| ^
168| });
169|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/11]⎯
FAIL src/lib/utilities/format-time.test.ts > getDuration > should get months/days/hours/minutes/seconds duration of a start and end date
AssertionError: expected { Object (years, months, ...) } to strictly equal { Object (days, hours, ...) }
- Expected
+ Received
Object {
"days": 11,
- "hours": 5,
+ "hours": 4,
"minutes": 5,
"months": 7,
"seconds": 45,
"years": 0,
}
❯ src/lib/utilities/format-time.test.ts:104:22
102| const distance = formatDistance({ start, end });
103| const abbvDistancer = formatDistanceAbbreviated({ start, end });
104| expect(duration).toStrictEqual({
| ^
105| days: 11,
106| hours: 5,
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/11]⎯
FAIL src/lib/utilities/format-date.test.ts > formatDate > should format local time
AssertionError: expected '2022-04-13 EDT 12:29:35.63' to deeply equal '2022-04-13 UTC 16:29:35.63'
- Expected
+ Received
- 2022-04-13 UTC 16:29:35.63
+ 2022-04-13 EDT 12:29:35.63
❯ src/lib/utilities/format-date.test.ts:51:39
49|
50| it('should format local time', () => {
51| expect(formatDate(date, 'local')).toEqual('2022-04-13 UTC 16:29:35.63');
| ^
52| });
53|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[6/11]⎯
FAIL src/lib/utilities/format-date.test.ts > formatDate > should shorten format for local and other timezones
AssertionError: expected '2022-04-13 12:29:35 PM' to deeply equal '2022-04-13 16:29:35 PM'
- Expected
+ Received
- 2022-04-13 16:29:35 PM
+ 2022-04-13 12:29:35 PM
❯ src/lib/utilities/format-date.test.ts:71:61
69|
70| it('should shorten format for local and other timezones', () => {
71| expect(formatDate(date, 'local', { abbrFormat: true })).toEqual(
| ^
72| '2022-04-13 16:29:35 PM',
73| );
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[7/11]⎯
FAIL src/lib/utilities/format-date.test.ts > formatDate > should shorten format without seconds if there are none for local and other timezones
AssertionError: expected '2022-04-13 12:29 PM' to deeply equal '2022-04-13 16:29 PM'
- Expected
+ Received
- 2022-04-13 16:29 PM
+ 2022-04-13 12:29 PM
❯ src/lib/utilities/format-date.test.ts:83:7
81| expect(
82| formatDate(dateWithoutSeconds, 'local', { abbrFormat: true }),
83| ).toEqual('2022-04-13 16:29 PM');
| ^
84| expect(formatDate(dateWithoutSeconds, 'utc', { abbrFormat: true })).toEqual(
85| '2022-04-13 16:29 PM',
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[8/11]⎯
FAIL src/lib/utilities/format-date.test.ts > getLocalTime > should get the local timezone
AssertionError: expected 'Eastern Daylight Time (EDT)' to be 'UTC' // Object.is equality
- Expected
+ Received
- UTC
+ Eastern Daylight Time (EDT)
❯ src/lib/utilities/format-date.test.ts:129:28
127| describe('getLocalTime', () => {
128| it('should get the local timezone', () => {
129| expect(getLocalTime()).toBe('UTC');
| ^
130| });
131| });
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[9/11]⎯
FAIL src/lib/utilities/format-date.test.ts > getSelectedTimezone > should get the local timezone
AssertionError: expected 'Eastern Daylight Time (EDT)' to be 'UTC' // Object.is equality
- Expected
+ Received
- UTC
+ Eastern Daylight Time (EDT)
❯ src/lib/utilities/format-date.test.ts:141:42
139|
140| it('should get the local timezone', () => {
141| expect(getSelectedTimezone('local')).toBe('UTC');
| ^
142| });
143|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[10/11]⎯
FAIL src/lib/stores/time-format.test.ts > getTimezone > should return the local timezone if the time format is local
AssertionError: expected 'America/New_York' to be 'UTC' // Object.is equality
- Expected
+ Received
- UTC
+ America/New_York
❯ src/lib/stores/time-format.test.ts:23:34
21|
22| test('should return the local timezone if the time format is local', () => {
23| expect(getTimezone('local')).toBe('UTC');
| ^
24| });
25|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[11/11]⎯
Test Files 4 failed (4)
Tests 11 failed | 123 passed (134)
Start at 16:15:58
Duration 1.25s
FAIL Tests failed. Watching for file changes...
press h to show help, press q to quit