Skip to content

Commit

Permalink
test: more
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed May 31, 2023
1 parent d2299c2 commit f9a52a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/configCases/worker/worklet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,30 @@ it("should allow to create a audioWorklet worklet #2", async () => {
await pseudoWorklet.terminate();
});

it("should allow to create a audioWorklet worklet #3", async () => {
let context = {
foo: {
bar: new AudioContext()
}
};
let pseudoWorklet = await context.foo.bar.audioWorklet.addModule(new URL("./worklet.js", import.meta.url));

pseudoWorklet = new pseudoWorklet();

expect(pseudoWorklet.url).not.toContain("asset-");

pseudoWorklet.postMessage("ok");

const result = await new Promise(resolve => {
pseudoWorklet.onmessage = event => {
resolve(event.data);
};
});
expect(result).toBe("data: OK, thanks");

await pseudoWorklet.terminate();
});

it("should allow to create a audioWorklet worklet using '?.'", async () => {
let context = new AudioContext();
let pseudoWorklet = await context?.audioWorklet?.addModule(new URL("./worklet.js", import.meta.url));
Expand Down
1 change: 1 addition & 0 deletions test/configCases/worker/worklet/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
"CSS.layoutWorklet.addModule()",
"CSS.animationWorklet.addModule()",
"*context.audioWorklet.addModule()",
"*context.foo.bar.audioWorklet.addModule()",
"*audioWorklet.addModule()",
// *addModule() is not valid syntax
"..."
Expand Down

0 comments on commit f9a52a6

Please sign in to comment.