aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/string_decoder/string-decoder.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/node/string_decoder/string-decoder.test.js')
-rw-r--r--test/js/node/string_decoder/string-decoder.test.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/js/node/string_decoder/string-decoder.test.js b/test/js/node/string_decoder/string-decoder.test.js
index f37326678..aba73401a 100644
--- a/test/js/node/string_decoder/string-decoder.test.js
+++ b/test/js/node/string_decoder/string-decoder.test.js
@@ -241,3 +241,12 @@ for (const StringDecoder of [FakeStringDecoderCall, RealStringDecoder]) {
});
});
}
+
+it("invalid utf-8 input, pr #3562", () => {
+ const decoder = new RealStringDecoder("utf-8");
+ let output = "";
+ output += decoder.write(Buffer.from("B9", "hex"));
+ output += decoder.write(Buffer.from("A9", "hex"));
+ output += decoder.end();
+ expect(output).toStrictEqual("\uFFFD\uFFFD");
+});