test: check codes of thrown errors

PR-URL: https://github.com/nodejs/node/pull/23519
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: George Adams <george.adams@uk.ibm.com>
This commit is contained in:
Nancy Truong authored and James M Snell committed 2018-10-21 12:25:02 -07:00
1 parent 52428c81cd
commit add4f019e4
2 files changed
+16 -7

No files matched your search

+6 -1
View File
@@ -40,7 +40,12 @@ assert.throws(function() {
Object.setPrototypeOf(AB, ArrayBuffer);
Object.setPrototypeOf(AB.prototype, ArrayBuffer.prototype);
Buffer.from(new AB());
}, TypeError);
}, {
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError [ERR_INVALID_ARG_TYPE]',
message: 'The first argument must be one of type string, Buffer,' +
' ArrayBuffer, Array, or Array-like Object. Received type object'
});
// Test the byteOffset and length arguments
{