diff options
Diffstat (limited to 'cli/tests/node_compat/test/parallel/test-buffer-arraybuffer.js')
-rw-r--r-- | cli/tests/node_compat/test/parallel/test-buffer-arraybuffer.js | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/cli/tests/node_compat/test/parallel/test-buffer-arraybuffer.js b/cli/tests/node_compat/test/parallel/test-buffer-arraybuffer.js index 9f515736e..286481758 100644 --- a/cli/tests/node_compat/test/parallel/test-buffer-arraybuffer.js +++ b/cli/tests/node_compat/test/parallel/test-buffer-arraybuffer.js @@ -2,8 +2,8 @@ // deno-lint-ignore-file // Copyright Joyent and Node contributors. All rights reserved. MIT license. -// Taken from Node 16.13.0 -// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually +// Taken from Node 18.12.1 +// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually. 'use strict'; @@ -42,21 +42,18 @@ assert.strictEqual(dv.getFloat64(8, true), 3.1415); // Now test protecting users from doing stupid things -// TODO(Soremwar) -// There is an inconsistency on feross implementation on how buffers are checked -// Enable once it's sorted out -// assert.throws(function() { -// function AB() { } -// Object.setPrototypeOf(AB, ArrayBuffer); -// Object.setPrototypeOf(AB.prototype, ArrayBuffer.prototype); -// Buffer.from(new AB()); -// }, { -// code: 'ERR_INVALID_ARG_TYPE', -// name: 'TypeError', -// message: 'The first argument must be of type string or an instance of ' + -// 'Buffer, ArrayBuffer, or Array or an Array-like Object. Received ' + -// 'an instance of AB' -// }); +assert.throws(function() { + function AB() { } + Object.setPrototypeOf(AB, ArrayBuffer); + Object.setPrototypeOf(AB.prototype, ArrayBuffer.prototype); + Buffer.from(new AB()); +}, { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError', + message: 'The first argument must be of type string or an instance of ' + + 'Buffer, ArrayBuffer, or Array or an Array-like Object. Received ' + + 'an instance of AB' +}); // Test the byteOffset and length arguments { |