diff options
author | Weijia Wang <381152119@qq.com> | 2017-07-13 07:58:59 +0800 |
---|---|---|
committer | Refael Ackermann <refack@gmail.com> | 2017-07-24 08:26:26 -0400 |
commit | 9cb390d8991978ceeaee4c7a80289f56a030aa00 (patch) | |
tree | ccca3a660a1223bf5c025c13a6bfdf675fc3c5f3 /test/parallel/test-c-ares.js | |
parent | 3566195196b81390d8dc1a7ccbca9a2c118df624 (diff) | |
download | android-node-v8-9cb390d8991978ceeaee4c7a80289f56a030aa00.tar.gz android-node-v8-9cb390d8991978ceeaee4c7a80289f56a030aa00.tar.bz2 android-node-v8-9cb390d8991978ceeaee4c7a80289f56a030aa00.zip |
errors: migrate dns to use internal/errors
PR-URL: https://github.com/nodejs/node/pull/14212
Refs: https://github.com/nodejs/node/issues/11273
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-c-ares.js')
-rw-r--r-- | test/parallel/test-c-ares.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index 6a8b08fd20..8ba221ca99 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -46,11 +46,21 @@ dns.lookup('::1', common.mustCall((error, result, addressType) => { assert.strictEqual(6, addressType); })); -// Try calling resolve with an unsupported type. -assert.throws(() => dns.resolve('www.google.com', 'HI'), /Unknown type/); - -// Try calling resolve with an unsupported type that's an object key -assert.throws(() => dns.resolve('www.google.com', 'toString'), /Unknown type/); +[ + // Try calling resolve with an unsupported type. + 'HI', + // Try calling resolve with an unsupported type that's an object key + 'toString' +].forEach((val) => { + common.expectsError( + () => dns.resolve('www.google.com', val), + { + code: 'ERR_INVALID_OPT_VALUE', + type: TypeError, + message: `The value "${val}" is invalid for option "rrtype"` + } + ); +}); // Windows doesn't usually have an entry for localhost 127.0.0.1 in // C:\Windows\System32\drivers\etc\hosts |