node/test/parallel/test-dns-regress-7070.js
Wallace Zhang e9b2325d68 test: test error messages in test-dns-regress-7070
Add a RegExp as a second argument to assert.throws().

PR-URL: https://github.com/nodejs/node/pull/10058
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-01-04 10:44:05 -06:00

10 lines
380 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const dns = require('dns');
// Should not raise assertion error. Issue #7070
assert.throws(() => dns.resolveNs([]), // bad name
/^Error: "name" argument must be a string$/);
assert.throws(() => dns.resolveNs(''), // bad callback
/^Error: "callback" argument must be a function$/);