@tokenflight/fiat-testkit
v0.0.1
Published
Mock provider and conformance suites for @tokenflight/fiat providers and state stores
Readme
@tokenflight/fiat-testkit
Build and verify @tokenflight/fiat extensions without real provider credentials.
mockProvider(options?)— a complete referenceFiatProviderAdapter(quotes, orders, signed webhooks). Use it as the template for a new provider, or to drive full quote → order → webhook flows in your own tests.createMockWebhook(secret, event)— signed (or deliberately tampered) webhook payloads for idempotency and verification tests.runProviderConformance(adapter, options)— checks a provider adapter against the contracts the SDK core relies on: RAW-integer quote amounts, future expiry, typed unsupported-asset rejection, action-matches-capabilities, webhook verify never throws / rejects tampered bodies, and more.runStateStoreConformance(makeStore)— checks a custom state store's concurrency semantics: version CAS conflicts, nonce replay, webhook dedup, job leases,listOrderspaging.
import { runProviderConformance, failedChecks } from "@tokenflight/fiat-testkit";
const results = await runProviderConformance(myProvider(), { asset: { chainId: 8453, address: "0x…" } });
expect(failedChecks(results)).toEqual([]);Framework-free: runners return CheckResult[] instead of asserting, so they work under vitest, jest, or a plain script.
© Khalani Labs, Ltd. All rights reserved.
