Skip to content

Commit e4ce550

Browse files
author
Johnny Reading
committed
test: add buffer transcode test
This test is for argument validation in transcode. feedback from approvers; full regex error msg & new line
1 parent 5887c2b commit e4ce550

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/parallel/test-icu-transcode.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@ for (const test in tests) {
3838
utf8_to_ucs2.toString('ucs2'));
3939
}
4040

41+
assert.throws(
42+
() => buffer.transcode(null, 'utf8', 'ascii'),
43+
/^TypeError: "source" argument must be a Buffer$/
44+
);
45+
4146
assert.throws(
4247
() => buffer.transcode(Buffer.from('a'), 'b', 'utf8'),
43-
/Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/
48+
/^Error: Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/
4449
);
50+
4551
assert.throws(
4652
() => buffer.transcode(Buffer.from('a'), 'uf8', 'b'),
47-
/Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/
53+
/^Error: Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]$/
4854
);

0 commit comments

Comments
 (0)