Skip to content

Commit ceb47d1

Browse files
XadillaXsxa
authored andcommitted
test: fix test-process-env-tz.js by using RegExp
Not all environment returns 'Central European Summer Time', 'British Summer Time' and 'Coordinated Universal Time'. E.g. Some environment like Chinese returns '中欧夏令时间', '英国夏令时间' and '协调世界时'. PR-URL: #42113 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent 04d2c74 commit ceb47d1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/parallel/test-process-env-tz.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ if (date.toString().includes('(Central European Time)') ||
3131
common.skip('tzdata too old');
3232
}
3333

34-
assert.strictEqual(
35-
date.toString().replace('Central European Summer Time', 'CEST'),
36-
'Sat Apr 14 2018 14:34:56 GMT+0200 (CEST)');
34+
assert.match(
35+
date.toString(),
36+
/^Sat Apr 14 2018 14:34:56 GMT\+0200 \(.+\)$/);
3737

3838
process.env.TZ = 'Europe/London';
39-
assert.strictEqual(
40-
date.toString().replace('British Summer Time', 'BST'),
41-
'Sat Apr 14 2018 13:34:56 GMT+0100 (BST)');
39+
assert.match(
40+
date.toString(),
41+
/^Sat Apr 14 2018 13:34:56 GMT\+0100 \(.+\)$/);
4242

4343
process.env.TZ = 'Etc/UTC';
44-
assert.strictEqual(
45-
date.toString().replace('Coordinated Universal Time', 'UTC'),
46-
'Sat Apr 14 2018 12:34:56 GMT+0000 (UTC)');
44+
assert.match(
45+
date.toString(),
46+
/^Sat Apr 14 2018 12:34:56 GMT\+0000 \(.+\)$/);
4747

4848
// Just check that deleting the environment variable doesn't crash the process.
4949
// We can't really check the result of date.toString() because we don't know

0 commit comments

Comments
 (0)