Test
Test
Fake providers with the real interfaces, Playwright theme checks, dev overlay and demo mode.
source-onlyNot on npm: run from the repo
Not on npm yet (private in its package.json). In a Signet workspace, depend on it as workspace:*:
{ "devDependencies": { "@dapplelight/signet-test": "workspace:*" } }Every peer is optional. Install the one a subpath needs: @dapplelight/signet-payments, @dapplelight/signet-server, ai, @playwright/test, react and @dapplelight/signet-ui.
Quick start
import { createPayments, memoryStore } from "@dapplelight/signet-payments"
import { fakeGateway } from "@dapplelight/signet-test/payments"
const gw = fakeGateway("razorpay")
const payments = createPayments({ gateways: [gw], db: memoryStore() })
const checkout = await payments.checkout({ amount: 49900, currency: "INR", idempotencyKey: "k1", userId: "u1" })
await payments.handleWebhook("razorpay", await gw.complete(checkout.gatewayId))Each fake implements the interface the real module takes, so the code under test runs unchanged, and each records its calls for assertions.
Root helpers
Imported from @dapplelight/signet-test itself.
| Export | What it does |
|---|---|
fakeClock(start?) | { now, date, set, advance }; pass now to any Signet option named now. Does not patch Date. |
SECOND, MINUTE, HOUR, DAY | Milliseconds. |
fakeFetch(routes?, options?) | A fetch answering from a "METHOD /path" table; unrouted calls 404; logs calls. |
fakeSenders(outbox?), fakeSender(...), createOutbox(options?) | Email, SMS, WhatsApp, push and Telegram senders writing to one outbox. |
fakeNotifyStore(options?) | In-memory NotifyStore whose TTLs follow the clock. |
import { DAY, fakeClock, fakeFetch } from "@dapplelight/signet-test"
const clock = fakeClock("2026-11-01T10:00:00Z")
clock.advance(30 * DAY)
const f = fakeFetch({ "GET /v1/invoices/inv_1": { id: "inv_1", status: "paid" } })
const res = await f.fetch("https://api.example.test/v1/invoices/inv_1")
console.log(f.calls[0]?.path) // "/v1/invoices/inv_1"