Pairtypeno test imports ittype Pair = { readonly source: Dest; readonly dest: Dest };Two stores, empty, made for one law.
The conformance of a bridge: the laws every pair of stores must keep under the transfers of this library, run against stores made by a function the caller gives. A backend's tests call runBridgeConformance, and a failed law says which and how. The laws are the ones a person relies on: a plan changes nothing, a sync is idempotent, a copy never deletes, a check after a sync finds no difference, and a plan that is out of date is refused.
import { runBridgeConformance } from "./mod.ts";
// const report = await runBridgeConformance(async () => ({ source: memoryStore(), dest: memoryStore() }));Pairtypeno test imports ittype Pair = { readonly source: Dest; readonly dest: Dest };Two stores, empty, made for one law.
MakePairtypetype MakePair = () => Promise<Pair>;What a caller gives: a function that makes a new pair.
BridgeCasetypeno test imports ittype BridgeCase = { readonly id: string; readonly title: string; readonly run: (make: MakePair) => Promise<void> };One law, with the capabilities it needs of the destination.
BridgeCaseReporttypeno test imports ittype BridgeCaseReport = { readonly id: string; readonly title: string; readonly failure?: string };What one law did.
BRIDGE_CASESconstconst BRIDGE_CASES: readonly BridgeCase[]Every law of the suite.
runBridgeConformancefunctionfunction runBridgeConformance(make: MakePair): Promise<readonly BridgeCaseReport[]>Runs every law against pairs made by make, and reports each.