summaryrefslogtreecommitdiff
path: root/cli/tests/node_compat/test/parallel/test-buffer-arraybuffer.js
diff options
context:
space:
mode:
authorAapo Alasuutari <aapo.alasuutari@gmail.com>2023-10-08 11:09:50 +0900
committerGitHub <noreply@github.com>2023-10-08 11:09:50 +0900
commiteffb5e1ce417e9b7f22adcdc598e9a5ec593f4a2 (patch)
tree620544d0d4051ad16d78c5df3fbed0441b800ea0 /cli/tests/node_compat/test/parallel/test-buffer-arraybuffer.js
parentedeccef4990598620bf5595df6fc8c1b1b1a7f73 (diff)
fix(node/buffer): utf8ToBytes should return a Uint8Array (#20769)
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.js31
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
{