diff options
author | Michaël Zasso <targos@protonmail.com> | 2021-08-29 10:14:22 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-08-31 18:50:16 +0200 |
commit | 508890d79594bab77d4fb084d9df3284c0550b29 (patch) | |
tree | d44d70d5298d1cddaebf263dafa682d507123f3c /test/internet | |
parent | 162f07b7af24692de32d47b26e7cc5e52fc4e0c2 (diff) | |
download | node-new-508890d79594bab77d4fb084d9df3284c0550b29.tar.gz |
test: use `assert.match` instead of `regexp.test`
PR-URL: https://github.com/nodejs/node/pull/39928
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Diffstat (limited to 'test/internet')
-rw-r--r-- | test/internet/test-dns-ipv6.js | 2 | ||||
-rw-r--r-- | test/internet/test-dns.js | 6 | ||||
-rw-r--r-- | test/internet/test-inspector-help-page.js | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js index 6f499b6894..7d2c18985e 100644 --- a/test/internet/test-dns-ipv6.js +++ b/test/internet/test-dns-ipv6.js @@ -142,7 +142,7 @@ TEST(function test_lookup_ipv6_hint(done) { assert(err instanceof Error); assert.strictEqual(err.code, 'EAI_BADFLAGS'); assert.strictEqual(err.hostname, addresses.INET_HOST); - assert.ok(/getaddrinfo EAI_BADFLAGS/.test(err.message)); + assert.match(err.message, /getaddrinfo EAI_BADFLAGS/); done(); return; } diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index 363dc92446..75f3e04c7c 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -527,7 +527,7 @@ TEST(function test_lookup_failure(done) { assert.ok(err instanceof Error); assert.strictEqual(err.code, dns.NOTFOUND); assert.strictEqual(err.code, 'ENOTFOUND'); - assert.ok(!/ENOENT/.test(err.message)); + assert.doesNotMatch(err.message, !/ENOENT/); assert.ok(err.message.includes(addresses.NOT_FOUND)); done(); @@ -640,7 +640,7 @@ TEST(function test_lookupservice_invalid(done) { const req = dns.lookupService('1.2.3.4', 80, (err) => { assert(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); - assert.ok(/1\.2\.3\.4/.test(err.message)); + assert.match(err.message, /1\.2\.3\.4/); done(); }); @@ -662,7 +662,7 @@ TEST(function test_reverse_failure(done) { assert(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); // Silly error code... assert.strictEqual(err.hostname, '203.0.113.0'); - assert.ok(/203\.0\.113\.0/.test(err.message)); + assert.match(err.message, /203\.0\.113\.0/); done(); }); diff --git a/test/internet/test-inspector-help-page.js b/test/internet/test-inspector-help-page.js index a6a38bd026..7baff031da 100644 --- a/test/internet/test-inspector-help-page.js +++ b/test/internet/test-inspector-help-page.js @@ -28,7 +28,7 @@ function check(url, cb) { }); res.on('end', common.mustCall(() => { - assert(/>Debugging Guide</.test(result)); + assert.match(result, />Debugging Guide</); cb(); })); })).on('error', common.mustNotCall); |