Browse Source

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>
v6.x
Wallace Zhang 8 years ago
committed by Michaël Zasso
parent
commit
25b76a44a7
  1. 6
      test/parallel/test-dns-regress-7070.js

6
test/parallel/test-dns-regress-7070.js

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

Loading…
Cancel
Save