aboutsummaryrefslogtreecommitdiff
path: root/test/js/first_party/utf-8-validate.test.ts
diff options
context:
space:
mode:
authorGravatar Ashcon Partovi <ashcon@partovi.net> 2023-07-05 13:16:10 -0700
committerGravatar Ashcon Partovi <ashcon@partovi.net> 2023-07-05 13:21:04 -0700
commit17bacd85f981180b1bf82515dfafafcada661fd7 (patch)
tree9b2ac8b6b4342c5becc541d4af8074af0afbd8c9 /test/js/first_party/utf-8-validate.test.ts
parentf61d9ef4761444d0550aea90b2656727d41ce1fa (diff)
downloadbun-17bacd85f981180b1bf82515dfafafcada661fd7.tar.gz
bun-17bacd85f981180b1bf82515dfafafcada661fd7.tar.zst
bun-17bacd85f981180b1bf82515dfafafcada661fd7.zip
Fix detect-libc
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();
+});