Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit 881b702

Browse files
committed
Detect environment and make some test optional.
1 parent 88f3983 commit 881b702

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

test/test-specific-zone-only.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Polyfill packaged with specific timezone data', () => {
6060
hour: 'numeric',
6161
minute: 'numeric',
6262
timeZoneName: 'long',
63-
timeZone: 'Antarctica/DumontDUrville'
63+
timeZone: 'Moon/Nearside'
6464
}).format(date);
6565
}, /RangeError/);
6666
});

test/test-specific-zone-specific-locale.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ describe('Polyfill packaged with specific timezone data', () => {
5858
assert.equal('06/12/2016 à 00:05 heure de Dumont-d’Urville', losAngelesTime);
5959
});
6060
}
61+
6162
if (Intl.DateTimeFormat.supportedLocalesOf('en').indexOf('en') >= 0) {
6263
it('should format if timeZoneName is printed with loaded locale', () => {
6364
const date = new Date(1480946713977);
@@ -76,21 +77,24 @@ describe('Polyfill packaged with specific timezone data', () => {
7677
});
7778
}
7879

79-
it('should throw exception if timeZoneName is printed with non-loaded locale', () => {
80-
const date = new Date(1480946713977);
80+
if (Intl.DateTimeFormat.supportedLocalesOf('hi').indexOf('hi') >= 0 &&
81+
!Intl._DateTimeFormatTimeZone.checkTimeZoneSupport('Antarctica/DumontDUrville')) {
82+
it('should throw exception if timeZoneName is printed with non-loaded locale', () => {
83+
const date = new Date(1480946713977);
8184

82-
assert.throws(() => {
83-
new Intl.DateTimeFormat('hi', {
84-
year: 'numeric',
85-
month: 'numeric',
86-
day: 'numeric',
87-
hour: 'numeric',
88-
minute: 'numeric',
89-
timeZoneName: 'long',
90-
timeZone: 'Antarctica/DumontDUrville'
91-
}).format(date);
92-
}, /RangeError/);
93-
});
85+
assert.throws(() => {
86+
new Intl.DateTimeFormat('hi', {
87+
year: 'numeric',
88+
month: 'numeric',
89+
day: 'numeric',
90+
hour: 'numeric',
91+
minute: 'numeric',
92+
timeZoneName: 'long',
93+
timeZone: 'Antarctica/DumontDUrville'
94+
}).format(date);
95+
}, /RangeError/);
96+
});
97+
}
9498
});
9599
});
96100
});

0 commit comments

Comments
 (0)