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 Myles Borins committed 2018-11-29 11:38:57 -05:00
1 parent f1fc05b45c
commit 232fe58a4c
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
{