Skip to content

Commit

Permalink
Fix or disable tests that are incompatible with older versions of Node.
Browse files Browse the repository at this point in the history
  • Loading branch information
12wrigja committed Feb 12, 2024
1 parent fcfb7f7 commit 990d51a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/ecmascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3236,6 +3236,7 @@ export function GetAvailableNamedTimeZoneIdentifier(
['Nsw', 'NSW'],
['Dar_Es_Salaam', 'Dar_es_Salaam'],
['Port_Of_Spain', 'Port_of_Spain'],
['Port-Au-Prince', 'Port-au-Prince'],
['Isle_Of_Man', 'Isle_of_Man'],
['Comodrivadavia', 'ComodRivadavia'],
['Knox_In', 'Knox_IN'],
Expand Down
9 changes: 6 additions & 3 deletions test/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ describe('ECMAScript', () => {
});

describe('GetAvailableNamedTimeZoneIdentifier', () => {
it('Case-normalizes time zone IDs', () => {
// Some environments don't support Intl.supportedValuesOf.
const itOrSkipIfNoIntlSupportedValuesOf = () => (Intl?.supportedValuesOf ? it : it.skip);
itOrSkipIfNoIntlSupportedValuesOf('Case-normalizes time zone IDs', () => {
// eslint-disable-next-line max-len
// curl -s https://raw.githubusercontent.com/unicode-org/cldr-json/main/cldr-json/cldr-bcp47/bcp47/timezone.json > cldr-timezone.json
const cldrTimeZonePath = new URL('./cldr-timezone.json', import.meta.url);
Expand All @@ -470,7 +472,8 @@ describe('ECMAScript', () => {
const missingFromCLDR = ['CET', 'EET', 'MET', 'WET'];

// All IDs that we know about
const ids = [...new Set([...missingFromCLDR, ...cldrIdentifiers, ...Intl.supportedValuesOf('timeZone')])];
const IntlNativeIdentifiers = Intl.supportedValuesOf('timeZone');
const ids = [...new Set([...missingFromCLDR, ...cldrIdentifiers, ...IntlNativeIdentifiers])];

for (const id of ids) {
const lower = id.toLowerCase();
Expand All @@ -480,7 +483,7 @@ describe('ECMAScript', () => {
equal(ES.GetAvailableNamedTimeZoneIdentifier(lower)?.identifier, id);
}
});
it('Returns canonical IDs', () => {
itOrSkipIfNoIntlSupportedValuesOf('Returns canonical IDs', () => {
const ids = Intl.supportedValuesOf('timeZone');
for (const id of ids) {
equal(ES.GetAvailableNamedTimeZoneIdentifier(id).primaryIdentifier, id);
Expand Down
3 changes: 3 additions & 0 deletions test/expected-failures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
# expected test failures for the transpiled or optimized builds of the polyfill,
# see expected-failures-es5.txt and expected-failures-opt.txt respectively.

# Upstream commit 076f2871 introduces a second ToString call on a calendar when
# canonicalizing the timezone name.
staging/Intl402/Temporal/old/date-time-format.js

0 comments on commit 990d51a

Please sign in to comment.