diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-01-06 13:22:38 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-06 13:22:38 +1100 |
commit | 54240c22af6233d1d977d469868b0d9050cad6da (patch) | |
tree | 81af9892f8728852387fad9c2d243ab933de927f /cli/tests/workers_test.ts | |
parent | 60c9c857584bf5180dd0f7b937683dd9691aef84 (diff) |
feat(cli): support data urls (#8866)
Closes: #5059
Co-authored-by: Valentin Anger <syrupthinker@gryphno.de>
Diffstat (limited to 'cli/tests/workers_test.ts')
-rw-r--r-- | cli/tests/workers_test.ts | 21 |
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(); |