aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/web-globals.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-15 22:12:04 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-15 22:12:04 -0700
commitb4049016ca3517a2596acc8f574f52584e0cb241 (patch)
treeb66a3ced9f8cffb6bf9b69ffe2e583b89846fb6e /integration/bunjs-only-snippets/web-globals.test.js
parent9eaa427ec978c9f472886f84ec5d8a1d5536d82a (diff)
downloadbun-b4049016ca3517a2596acc8f574f52584e0cb241.tar.gz
bun-b4049016ca3517a2596acc8f574f52584e0cb241.tar.zst
bun-b4049016ca3517a2596acc8f574f52584e0cb241.zip
some more tests
Diffstat (limited to 'integration/bunjs-only-snippets/web-globals.test.js')
-rw-r--r--integration/bunjs-only-snippets/web-globals.test.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/web-globals.test.js b/integration/bunjs-only-snippets/web-globals.test.js
new file mode 100644
index 000000000..e70e823e8
--- /dev/null
+++ b/integration/bunjs-only-snippets/web-globals.test.js
@@ -0,0 +1,30 @@
+import { expect, test } from "bun:test";
+
+test("exists", () => {
+ expect(typeof URL !== "undefined").toBe(true);
+ expect(typeof URLSearchParams !== "undefined").toBe(true);
+ expect(typeof DOMException !== "undefined").toBe(true);
+ expect(typeof Event !== "undefined").toBe(true);
+ expect(typeof EventTarget !== "undefined").toBe(true);
+ expect(typeof AbortController !== "undefined").toBe(true);
+ expect(typeof AbortSignal !== "undefined").toBe(true);
+ expect(typeof CustomEvent !== "undefined").toBe(true);
+ expect(typeof Headers !== "undefined").toBe(true);
+ expect(typeof ErrorEvent !== "undefined").toBe(true);
+ expect(typeof CloseEvent !== "undefined").toBe(true);
+ expect(typeof TextEncoder !== "undefined").toBe(true);
+});
+
+test("CloseEvent", () => {
+ var event = new CloseEvent("close", { reason: "world" });
+ expect(event.type).toBe("close");
+ const target = new EventTarget();
+ var called = false;
+ target.addEventListener("close", ({ type, reason }) => {
+ expect(type).toBe("close");
+ expect(reason).toBe("world");
+ called = true;
+ });
+ target.dispatchEvent(event);
+ expect(called).toBe(true);
+});