Browse Source

test: validate error message from buffer.equals

Adding regular expression as an argument to an assert.throws().

PR-URL: https://github.com/nodejs/node/pull/11215
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
v6
Sebastian Roeder 8 years ago
committed by Yuta Hiroto
parent
commit
f8cdaaa16a
  1. 3
      test/parallel/test-buffer-equals.js

3
test/parallel/test-buffer-equals.js

@ -14,4 +14,5 @@ assert.ok(!d.equals(e));
assert.ok(d.equals(d)); assert.ok(d.equals(d));
assert.ok(d.equals(new Uint8Array([0x61, 0x62, 0x63, 0x64, 0x65]))); assert.ok(d.equals(new Uint8Array([0x61, 0x62, 0x63, 0x64, 0x65])));
assert.throws(() => Buffer.alloc(1).equals('abc')); assert.throws(() => Buffer.alloc(1).equals('abc'),
/^TypeError: Argument must be a Buffer or Uint8Array$/);

Loading…
Cancel
Save