@metreeca/keep
    Preparing search index...

    Interface StoreTestOptions<S>

    Options for running a store conformance suite.

    interface StoreTestOptions<S extends StoreClient = StoreClient> {
        target?: readonly StoreTestPatterns[];
        ignore?: readonly StoreTestPatterns[];
        open: () => Awaitable<S>;
        close?: () => Awaitable<void>;
        contains: (entry: string) => Awaitable<boolean>;
        includes: <S extends Lazy<ResourceShape>>(
            entry: Probe<S>,
            shape: S,
        ) => Awaitable<boolean>;
        excludes: <S extends Lazy<ResourceShape>>(
            entry: Probe<S>,
            shape: S,
        ) => Awaitable<boolean>;
        populate: () => Awaitable<void>;
        generate: <S extends Lazy<ResourceShape>>(
            sample: State<S> & Resource,
            shape: S,
        ) => Awaitable<State<S>>;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    target?: readonly StoreTestPatterns[]

    Execute only the sub-suites or tests whose path contains any of the given patterns.

    Patterns are matched as substrings against the full test path, formed by joining the well-known sub-suite tag (PersistUpdate, RetrieveTemplate, …) with the inner describe/it names using > as separator, for example PersistUpdate > update > contract > should return the resource id for an existing resource.

    Well-known sub-suite tags are listed inline as autocomplete hints; arbitrary patterns are accepted via the (string & {}) branch and may target individual describe blocks or test names. When omitted (or empty), every sub-suite and test runs unless ignored.

    ignore?: readonly StoreTestPatterns[]

    Ignore sub-suites or tests whose path contains any of the given patterns.

    Same matching semantics as target. An ignore match always wins: a path matched by both target and ignore is skipped.

    open: () => Awaitable<S>

    Opens a store instance with the required schema but no sample data.

    Called once before all tests, paired with close for teardown. Sample data is loaded separately via populate.

    close?: () => Awaitable<void>

    Closes the store instance after all tests complete.

    contains: (entry: string) => Awaitable<boolean>

    Checks whether the store contains a resource with the given identifier.

    Returns true if the resource has any stored data at all; false otherwise. Unlike includes, this performs an identity-only check without verifying specific property values.

    Type Declaration

      • (entry: string): Awaitable<boolean>
      • Parameters

        • entry: string

          The resource identifier to check

        Returns Awaitable<boolean>

    includes: <S extends Lazy<ResourceShape>>(
        entry: Probe<S>,
        shape: S,
    ) => Awaitable<boolean>

    Checks whether every fact described by a resource is present in the store.

    Returns true if every fact described by entry (scalar values, references, nested structures) is present; false otherwise. Mutation tests rely on it to verify persisted content without depending on StoreClient.lookup.

    Accepts partial resources: only the slots explicitly set on entry contribute facts, and omitted slots are not checked. Full validated states behave as whole-state equality checks; narrower probes assert a targeted subset of facts.

    Type Declaration

      • <S extends Lazy<ResourceShape>>(entry: Probe<S>, shape: S): Awaitable<boolean>
      • Type Parameters

        • S extends Lazy<ResourceShape>

          The resource shape the probe and its facts conform to

        Parameters

        • entry: Probe<S>

          A resource (possibly partial) whose specified facts must all be present

        • shape: S

          The resource shape describing the resource structure

        Returns Awaitable<boolean>

    excludes: <S extends Lazy<ResourceShape>>(
        entry: Probe<S>,
        shape: S,
    ) => Awaitable<boolean>

    Checks whether every fact described by a resource is absent from the store.

    Returns true if none of the facts described by entry (scalar values, references, nested structures) are present; false if any fact is still present. Mirror of includes: where includes asserts all-present, excludes asserts all-absent.

    Accepts partial resources under the same semantics as includes: only explicitly-set slots contribute facts. Probes narrow to the exact slots whose facts are expected to be gone, since a fuller state would also cover facts the operation under test leaves in place.

    Type Declaration

      • <S extends Lazy<ResourceShape>>(entry: Probe<S>, shape: S): Awaitable<boolean>
      • Type Parameters

        • S extends Lazy<ResourceShape>

          The resource shape the probe and its facts conform to

        Parameters

        • entry: Probe<S>

          A resource (typically partial) whose specified facts must all be absent

        • shape: S

          The resource shape describing the resource structure

        Returns Awaitable<boolean>

    populate: () => Awaitable<void>

    Populates the store with the sample dataset.

    Must clear all existing data and perform a full reload: any resources created, updated, or deleted by previous tests must be removed so that only the original sample data is present.

    Called by the retrieval sub-suites before their tests run, so each of them reads the pristine sample dataset.

    generate: <S extends Lazy<ResourceShape>>(
        sample: State<S> & Resource,
        shape: S,
    ) => Awaitable<State<S>>

    Generates an isolated copy of a sample resource with a unique identifier and inserts it into the store.

    Mutation tests rely on it to create isolated resources that do not conflict with the sample dataset or other tests. The clone helper mints a suitable copy.

    Type Declaration

      • <S extends Lazy<ResourceShape>>(
            sample: State<S> & Resource,
            shape: S,
        ): Awaitable<State<S>>
      • Type Parameters

        • S extends Lazy<ResourceShape>

        Parameters

        • sample: State<S> & Resource

          The sample resource to use as template, typically drawn from the sample dataset

        • shape: S

          The resource shape describing the resource structure

        Returns Awaitable<State<S>>

        The inserted copy with a unique id