aboutsummaryrefslogtreecommitdiff
path: root/test/js/first_party/utf-8-validate.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/first_party/utf-8-validate.test.ts')
-rw-r--r--test/js/first_party/utf-8-validate.test.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/js/first_party/utf-8-validate.test.ts b/test/js/first_party/utf-8-validate.test.ts
new file mode 100644
index 000000000..33469c970
--- /dev/null
+++ b/test/js/first_party/utf-8-validate.test.ts
@@ -0,0 +1,9 @@
+import { test, expect } from "bun:test";
+import { isUtf8 } from "node:buffer";
+import isValidUTF8 from "utf-8-validate";
+
+test("utf-8-validate", () => {
+ expect(isValidUTF8).toBe(isUtf8);
+ expect(isValidUTF8(Buffer.from("😀"))).toBeTrue();
+ expect(isValidUTF8(Buffer.from([0xff]))).toBeFalse();
+});