Skip to content

Commit 847d740

Browse files
tniessendanielleadams
authored andcommitted
test: fix assertions in test-snapshot-dns-lookup*
Due to the unfortunate nature of JavaScript, the extraneous arguments are silently ignored. In this case, the assertion trivially passes regardless of the given regular expressions. Refs: #44633 PR-URL: #46618 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Harshitha K P <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent b9dd876 commit 847d740

3 files changed

+6
-6
lines changed

test/internet/test-snapshot-dns-lookup.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const env = {
1919

2020
tmpdir.refresh();
2121
function checkOutput(stderr, stdout) {
22-
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
23-
assert(stdout.match(stdout, /family: 4/));
22+
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
23+
assert.match(stdout, /family: 4/);
2424
assert.strictEqual(stdout.trim().split('\n').length, 2);
2525
}
2626
{

test/parallel/test-snapshot-dns-lookup-localhost-promise.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function checkOutput(stderr, stdout) {
1919
// We allow failures as it's not always possible to resolve localhost.
2020
// Functional tests are done in test/internet instead.
2121
if (!stderr.startsWith('error:')) {
22-
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
23-
assert(stdout.match(stdout, /family: 4/));
22+
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
23+
assert.match(stdout, /family: 4/);
2424
assert.strictEqual(stdout.trim().split('\n').length, 2);
2525
}
2626
}

test/parallel/test-snapshot-dns-lookup-localhost.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function checkOutput(stderr, stdout) {
1919
// We allow failures as it's not always possible to resolve localhost.
2020
// Functional tests are done in test/internet instead.
2121
if (!stderr.startsWith('error:')) {
22-
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
23-
assert(stdout.match(stdout, /family: 4/));
22+
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
23+
assert.match(stdout, /family: 4/);
2424
assert.strictEqual(stdout.trim().split('\n').length, 2);
2525
}
2626
}

0 commit comments

Comments
 (0)