IF Commons GitHub

conformance/mod

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0005-bridge-conformance FR-001

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() }));

Source: commons/anyfs-bridge/src/conformance/mod.ts

3 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Pairtypeno test imports it
type Pair = { readonly source: Dest; readonly dest: Dest };

Two stores, empty, made for one law.

MakePairtype
type MakePair = () => Promise<Pair>;

What a caller gives: a function that makes a new pair.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

BridgeCasetypeno test imports it
type 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 it
type BridgeCaseReport = { readonly id: string; readonly title: string; readonly failure?: string };

What one law did.

BRIDGE_CASESconst
const BRIDGE_CASES: readonly BridgeCase[]

Every law of the suite.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

runBridgeConformancefunction
function runBridgeConformance(make: MakePair): Promise<readonly BridgeCaseReport[]>

Runs every law against pairs made by make, and reports each.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.