summaryrefslogtreecommitdiff
path: root/test/parallel/test-icu-transcode.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-icu-transcode.js')
-rw-r--r--test/parallel/test-icu-transcode.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/parallel/test-icu-transcode.js b/test/parallel/test-icu-transcode.js
index c099e754ca..fc588b220f 100644
--- a/test/parallel/test-icu-transcode.js
+++ b/test/parallel/test-icu-transcode.js
@@ -40,7 +40,7 @@ for (const test in tests) {
assert.throws(
() => buffer.transcode(null, 'utf8', 'ascii'),
- /^TypeError: "source" argument must be a Buffer$/
+ /^TypeError: "source" argument must be a Buffer or Uint8Array$/
);
assert.throws(
@@ -62,3 +62,11 @@ assert.deepStrictEqual(
assert.deepStrictEqual(
buffer.transcode(Buffer.from('hä', 'latin1'), 'latin1', 'utf16le'),
Buffer.from('hä', 'utf16le'));
+
+// Test that Uint8Array arguments are okay.
+{
+ const uint8array = new Uint8Array([...Buffer.from('hä', 'latin1')]);
+ assert.deepStrictEqual(
+ buffer.transcode(uint8array, 'latin1', 'utf16le'),
+ Buffer.from('hä', 'utf16le'));
+}