summaryrefslogtreecommitdiff
path: root/cli/tests/node_compat/test/parallel/test-buffer-bytelength.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-bytelength.js
parentedeccef4990598620bf5595df6fc8c1b1b1a7f73 (diff)
fix(node/buffer): utf8ToBytes should return a Uint8Array (#20769)
Diffstat (limited to 'cli/tests/node_compat/test/parallel/test-buffer-bytelength.js')
-rw-r--r--cli/tests/node_compat/test/parallel/test-buffer-bytelength.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/cli/tests/node_compat/test/parallel/test-buffer-bytelength.js b/cli/tests/node_compat/test/parallel/test-buffer-bytelength.js
index e23b3c3c2..7fb62c78f 100644
--- a/cli/tests/node_compat/test/parallel/test-buffer-bytelength.js
+++ b/cli/tests/node_compat/test/parallel/test-buffer-bytelength.js
@@ -2,15 +2,15 @@
// 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';
const common = require('../common');
const assert = require('assert');
const SlowBuffer = require('buffer').SlowBuffer;
-const vm = require('vm');
+// const vm = require('vm');
[
[32, 'latin1'],
@@ -30,8 +30,6 @@ const vm = require('vm');
);
});
-assert.strictEqual(Buffer.byteLength('', undefined, true), -1);
-
assert(ArrayBuffer.isView(new Buffer(10)));
assert(ArrayBuffer.isView(new SlowBuffer(10)));
assert(ArrayBuffer.isView(Buffer.alloc(10)));
@@ -98,6 +96,7 @@ assert.strictEqual(Buffer.byteLength('aGkk', 'base64'), 3);
assert.strictEqual(
Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==', 'base64'), 25
);
+// base64url
assert.strictEqual(Buffer.byteLength('aGVsbG8gd29ybGQ', 'base64url'), 11);
assert.strictEqual(Buffer.byteLength('aGVsbG8gd29ybGQ', 'BASE64URL'), 11);
assert.strictEqual(Buffer.byteLength('bm9kZS5qcyByb2NrcyE', 'base64url'), 14);
@@ -128,7 +127,7 @@ assert.strictEqual(Buffer.byteLength('Il était tué', 'utf8'), 14);
// TODO(Soremwar)
// Enable once vm module is available
-// // Test that ArrayBuffer from a different context is detected correctly
+// Test that ArrayBuffer from a different context is detected correctly
// const arrayBuf = vm.runInNewContext('new ArrayBuffer()');
// assert.strictEqual(Buffer.byteLength(arrayBuf), 0);