Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

work around test environments that don't know their timezone. #3664

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions packages/test-app/tests/unit/services/timezone-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ module('Unit | Service | timezone', function (hooks) {
const names = service.getTimezoneNames();
const currentTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
assert.ok(names.includes(currentTimezone));
if (currentTimezone === 'UTC') {
//we already know it's in the list because it is the current zone
//however we now want to remove it because it won't ever display
//for users, just in CI
names.splice(names.indexOf('UTC'));
// KLUDGE!
// Some of the test environments (mobile platforms) in our CI/CD pipeline either serve up 'UTC'
// as current timezone name, or - even worse - a timezone offset instead of a AINA timezone name.
// But that's not how the real world functions, this only ever happens in these broken test environments.
// So let's pretend this isn't happening and filter these out to prevent test breakage.
// [ST 2023/01/24]
if (
currentTimezone === 'UTC' ||
!!currentTimezone.match('^([+-](?:2[0-3]|[01][0-9]):[0-5][0-9])$')
) {
names.splice(names.indexOf(currentTimezone), 1);
}
assert.notOk(names.includes('Etc/GMT-13'));
assert.notOk(names.includes('Canada/Newfoundland'));
Expand Down
Loading