Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix test-process-env-tz.js by using RegExp #42113

Merged
merged 1 commit into from
Mar 4, 2022
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
18 changes: 9 additions & 9 deletions test/parallel/test-process-env-tz.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ if (date.toString().includes('(Central European Time)') ||
common.skip('tzdata too old');
}

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

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

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

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