-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamically load the webworker blob (#83)
* dynamically load the webworker blob * dynamic loading of web worker * switch to jsdelivr
- Loading branch information
Showing
4 changed files
with
54 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { createCircuitWebWorker } from "lib" | ||
import { expect, test } from "bun:test" | ||
|
||
// TODO should skip b/c uses network | ||
test("example6-dynamic-load-blob-url", async () => { | ||
const circuitWebWorker = await createCircuitWebWorker({}) | ||
|
||
await circuitWebWorker.execute(` | ||
import { RedLed } from "@tsci/seveibar.red-led" | ||
circuit.add( | ||
<board width="10mm" height="10mm"> | ||
<RedLed name="LED1" /> | ||
</board> | ||
) | ||
`) | ||
|
||
await circuitWebWorker.renderUntilSettled() | ||
|
||
const circuitJson = await circuitWebWorker.getCircuitJson() | ||
|
||
expect(circuitJson).toBeDefined() | ||
|
||
const led = circuitJson.find((el: any) => el.name === "LED1") | ||
expect(led).toBeDefined() | ||
expect(led?.type).toBe("source_component") | ||
}) |