@ekanos/sdk/testing gives you the same context production builds get, in memory: same schema validation, same egress allowlist, same secret tier rules, no network.
Create a mock context
Test tools
Test webhooks
invokeWebhook builds the context from the definition — its slug, storage schemas, and egress — so contextOptions cannot override those. It throws if the webhook id is not declared or the payload fails payloadSchema; the handler never runs. Signatures are never verified locally: for a signed webhook, the skip is recorded as one warn line on ctx.logs. To prove a declaration’s signature settings, call verifyDeclaredWebhookSignature() (async; an empty secret fails closed) — see Webhooks.
Test schedules
context OR contextOptions, never both — passing both throws a TypeError. invokeSchedule throws if the schedule id is not declared.
Test activation hooks
onActivate is not declared, or if the handler itself throws. invokeActivate is a bare invoker, not the host — the non-fatal (log-and-continue) handling is applied by whatever calls the hook in production or in the harness, so a test of that behavior should catch the rejection itself.
Test on a Source connection
Passconnection and routing to run a tool, a webhook or a channel hook the way a provided agent runs it on a Source connection. routing needs connection: { owner: 'source' }, as on the host; without either, the mock is the team’s own connection.
invokeUnrouted runs on the Source connection with no routing, at the event’s conversation() target, and throws if the event has none. invokeRouteKeys throws if a routeKeys function returns anything but { value, label? } or null. See Routing and Source connections.
Common patterns
Test with multiple assertions
Test error handling
Test egress denial
Test storage validation
Record fetch calls
{ url, init?, denied: boolean }, in order, allowed and denied alike.
Record logs
{ level: 'debug' | 'info' | 'warn' | 'error', context, message }.
Testing without the harness
You do not need@ekanos/cli or @ekanos/harness to test handlers, webhooks, schedules, or activation hooks. Everything in this section works with vitest and createMockContext() alone.
For widget tests that call useIntegrationFetch(), createMockFetchProvider(handlers) returns a provider component that answers from the same MockFetchHandler fixtures (no egress check). Seeing widgets, tiles, and forms rendered in Ekanos chrome takes the harness.
Next steps
- Styling — import styles in components
- Capability context — understand ctx
- Each surface — detailed examples per feature