conformance
The test suites every storage adapter runs against itself, so that Log works the same over
each: what the storage contract promises of positions, commits, idempotency keys, entry reads,
waiting, and standalone appends, across hosts over the same storage. An adapter’s tests call
run with a Fixture, which opens fresh storage for each test and stores over it. The suites
need @effect/vitest, an optional peer dependency of this package, which only an adapter’s
tests install.
Example (The memory store’s conformance test)
import { MemoryStore } from "@amends-dev/log"import * as Conformance from "@amends-dev/log/conformance"import { Effect } from "effect"
Conformance.run({ name: "memory", available: true, withStorage: (use) => Effect.scoped( Effect.flatMap(MemoryStore.makeDatabase, (database) => use({ connect: () => Effect.provideServiceEffect(MemoryStore.make, MemoryStore.Binding, MemoryStore.bind(database)) }) ) )})Since v0.2.0
Testing
Section titled “Testing”ConnectOptions
Section titled “ConnectOptions”How Storage.connect opens a store, re-exported so a fixture needs only this module.
Signature
declare const ConnectOptions: Fixture.ConnectOptionsSince v0.2.0
Fixture
Section titled “Fixture”What an adapter’s tests give run.
Signature
declare const Fixture: Fixture.FixtureSince v0.2.0
Storage
Section titled “Storage”One test’s storage, which Fixture.withStorage gives the test.
Signature
declare const Storage: Fixture.StorageSince v0.2.0
Runs every suite against the storage fixture opens, in the test file that calls it.
Signature
declare const run: (fixture: Fixture.Fixture) => voidSince v0.2.0