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: DeepPartial<State<S>>,
            shape: S,
        ) => Awaitable<boolean>;
        excludes: <S extends Lazy<ResourceShape>>(
            entry: DeepPartial<State<S>>,
            shape: S,
        ) => Awaitable<boolean>;
        populate: () => Awaitable<void>;
        generate: <S extends Lazy<ResourceShape>>(
            sample: State<S>,
            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 — e.g. 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: DeepPartial<State<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 resource (scalar values, references, nested structures) is present; false otherwise. Used by mutation tests to verify persisted content without depending on StoreClient.lookup.

    Accepts partial resources: only the slots explicitly set on resource contribute facts — omitted slots produce no triples and 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: DeepPartial<State<S>>,
            shape: S,
        ): Awaitable<boolean>
      • Type Parameters

        • S extends Lazy<ResourceShape>

          The resource shape the probe and its facts conform to

        Parameters

        • entry: DeepPartial<State<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: DeepPartial<State<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 resource (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. Passing a full state yields an always-false check (operations leave at least some facts behind); probes should narrow to the exact slots whose triples are expected to be gone.

    Type Declaration

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

        • S extends Lazy<ResourceShape>

          The resource shape the probe and its facts conform to

        Parameters

        • entry: DeepPartial<State<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 individual sub-suites via beforeAll to populate or repopulate the store before their tests run.

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

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

    Used by mutation tests to create isolated resources that do not conflict with the sample dataset or other tests.

    Type Declaration

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

        • S extends Lazy<ResourceShape>

        Parameters

        • sample: State<S>

          The sample resource to use as template, validated with value scope

        • shape: S

          The resource shape describing the resource structure

        Returns Awaitable<State<S>>

        The inserted copy with a unique id