Skip to content

Commit 8bbe0b6

Browse files
committed
Support isolated storage and remove Engine DO bindings to runnerWorker
1 parent b15e623 commit 8bbe0b6

File tree

12 files changed

+198
-130
lines changed

12 files changed

+198
-130
lines changed

fixtures/vitest-pool-workers-examples/workflows/test/integration.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
import { beforeEach } from "node:test";
12
import { env, introspectWorkflow, SELF } from "cloudflare:test";
23
import { describe, expect, it, vi } from "vitest";
34

45
const STATUS_COMPLETE = "complete";
56

67
describe("Test Workflow", () => {
78
it("should be able to trigger a workflow", async () => {
9+
// With `using` to ensure cleanup:
10+
await using introspector = await introspectWorkflow(env.TEST_WORKFLOW);
811
const res = await SELF.fetch("https://mock-worker.local");
912

1013
expect(res.status).toBe(200);
1114
});
1215

1316
it("workflow should reach the end and be successful", async () => {
17+
// With `using` to ensure cleanup:
18+
await using introspector = await introspectWorkflow(env.TEST_WORKFLOW);
1419
const res = await SELF.fetch("https://mock-worker.local");
1520

1621
const json = await res.json<{ id: string }>();
@@ -68,7 +73,8 @@ describe("Test long Workflow", () => {
6873
// CLEANUP: done by Symbol.asyncDispose
6974
});
7075

71-
it("workflow batch should be able to introspect and reach the end and be successful", async () => {
76+
it("workflow batch should be able to introspect and reach the end and be successful (explicit cleanup)", async () => {
77+
// CONFIG:
7278
let introspector = await introspectWorkflow(env.TEST_LONG_WORKFLOW);
7379
introspector.modifyAll(async (m) => {
7480
await m.disableSleeps();
@@ -91,6 +97,6 @@ describe("Test long Workflow", () => {
9197
// CLEANUP:
9298
// Workflow introspector should be cleaned at the end of/after each test, if no `using` keyword is used for the introspector
9399
// Cleans up all intercepted instances
94-
introspector.cleanUp();
100+
await introspector.cleanUp();
95101
});
96102
});

0 commit comments

Comments
 (0)