@wild-framework/testing
v0.1.1
Published
Testing helpers for Wild Framework — fake events, queue, mail, and a test application builder.
Maintainers
Readme
@wild-framework/testing
Testing helpers for Wild Framework.
Fakes and a test application builder so features can be tested without real infrastructure — mock events, queue, and mail via the container.
Install
pnpm add -D @wild-framework/testingQuick start
import { createTestApplication, FakeEventBus, FakeQueue, FakeMail } from "@wild-framework/testing";
import { OrderService, OrderPlaced } from "./features/orders/index.js";
import { OrderProvider } from "./features/orders/order-provider.js";
const app = await createTestApplication({ providers: [OrderProvider] });
const events = app.resolve(FakeEventBus); // or FakeQueue / FakeMail
await app.resolve(OrderService).place(...);
expect(events.wasDispatched(OrderPlaced)).toBe(true);What it provides
FakeEventBus— captures dispatched events (dispatchedOf,wasDispatched,dispatchCount)FakeQueue— captures dispatched jobs without running themFakeMail— captures sent messages (sentWithSubject,sentCount)createTestApplication()— boots a container-wired app and binds the fakes under both the fake tokens and the realEventBus/Queue/Mailtokens, so your feature code gets the fakes automatically
Pass realEvents: true, realQueue: true, or realMail: true to use the
real providers instead.
