0.1.0 • Published 8 months ago
@effection-contrib/test-adapter v0.1.0
Test Adapter
An abstract helper for integrating Effection with testing frameworks.
Typically, you won't use this module directly, but instead you'll use one of the
actual testing framework integrations. The following shows how you might
integrate it with the @std/bdd
module. You would never use it this way, this
demonstrates the general pattern of lifecycle.
import { run, sleep } from "effection";
import { createTestAdapter, TestAdapter } from "@effection-contrib/test-adapter";
import { describe, it, beforeEach } from "@std/bdd";
describe("something", () => {
let adapter: TestAdapter;
beforeAll(() => {)
adapter = createTestAdapter("something");
});
afterAll(() => adapter.destroy())
adapter.addSetup(function*() {
/* do some setup. equivalent of beforeEach() */
/* contexts set here will be visible in the test */*
});
it("does a thing", async () => {
await adapter.runTest(function*() {
/* ... the body of the test */
});
});
});
0.1.0
8 months ago