summaryrefslogtreecommitdiff
path: root/cli/tests/workers_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/workers_test.ts')
-rw-r--r--cli/tests/workers_test.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/tests/workers_test.ts b/cli/tests/workers_test.ts
index d907c97a9..3bfe0181a 100644
--- a/cli/tests/workers_test.ts
+++ b/cli/tests/workers_test.ts
@@ -47,6 +47,27 @@ Deno.test({
});
Deno.test({
+ name: "worker from data url",
+ async fn() {
+ const promise = deferred();
+ const tsWorker = new Worker(
+ "data:application/typescript;base64,aWYgKHNlbGYubmFtZSAhPT0gInRzV29ya2VyIikgewogIHRocm93IEVycm9yKGBJbnZhbGlkIHdvcmtlciBuYW1lOiAke3NlbGYubmFtZX0sIGV4cGVjdGVkIHRzV29ya2VyYCk7Cn0KCm9ubWVzc2FnZSA9IGZ1bmN0aW9uIChlKTogdm9pZCB7CiAgcG9zdE1lc3NhZ2UoZS5kYXRhKTsKICBjbG9zZSgpOwp9Owo=",
+ { type: "module", name: "tsWorker" },
+ );
+
+ tsWorker.onmessage = (e): void => {
+ assertEquals(e.data, "Hello World");
+ promise.resolve();
+ };
+
+ tsWorker.postMessage("Hello World");
+
+ await promise;
+ tsWorker.terminate();
+ },
+});
+
+Deno.test({
name: "worker nested",
fn: async function (): Promise<void> {
const promise = deferred();