Domain SDK
Guides

Test without external API calls

Simulate latency, failures, transitions, and calls with isolated memory providers.

domain-flow.test.ts
const memory = memoryProvider({ latencyMs: 5, initialStatus: "pending_dns" });
const domains = createDomainClient({ provider: memory });
await domains.add("app.customer.com");
memory.transition("app.customer.com", "pending_certificate");
memory.activate("app.customer.com");
expect(memory.calls.map((call) => call.operation)).toContain("add");

Use createFailingProvider(new DomainSdkError(...)) for application error paths. Normal package tests never require credentials or internet access.

Read next: Testing provider.