Skip to content

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

How Storage.connect opens a store, re-exported so a fixture needs only this module.

Signature

declare const ConnectOptions: Fixture.ConnectOptions

Source

Since v0.2.0

What an adapter’s tests give run.

Signature

declare const Fixture: Fixture.Fixture

Source

Since v0.2.0

One test’s storage, which Fixture.withStorage gives the test.

Signature

declare const Storage: Fixture.Storage

Source

Since 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) => void

Source

Since v0.2.0