Documentation
    Preparing search index...

    Interface ISearchProps<Entity, Values, Request>

    Configuration interface for search validation functionality.

    Defines the structure needed to validate search operations by specifying how to extract search values from entities, filter the dataset manually, and construct API requests.

    contracts/common.md#principled-implementation The record supplies what the check needs from a test author: the field names for the message and the three functions that extract values, filter, and build the request.

    contracts/common.md#clear-and-simple-design A four-member record with the functions as methods.

    contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.

    contracts/common.md#meaningful-documentation The comment names the role of the record and each member documents itself.

    interface ISearchProps<
        Entity extends IEntity<any>,
        Values extends any[],
        Request,
    > {
        fields: string[];
        filter(entity: Entity, values: Values): boolean;
        request(values: Values): Request;
        values(entity: Entity): Values;
    }

    Type Parameters

    • Entity extends IEntity<any>

      Type of entities being searched, must have an ID field

    • Values extends any[]

      Tuple type representing the search values extracted from entities

    • Request

      Type of the API request object

    Index
    fields: string[]

    Field names being searched, used in error messages for identification

    • Manual filter function to determine if an entity matches search criteria

      Parameters

      • entity: Entity

        Entity to test against criteria

      • values: Values

        Search values to match against

      Returns boolean

      True if entity matches the search criteria

      contracts/common.md#principled-implementation The predicate decides whether an entity matches the values, which is the manual reference against which the API is compared.

      contracts/common.md#clear-and-simple-design One predicate over an entity and the values.

      contracts/common.md#prohibited-implementation-shortcuts It is caller code.

      contracts/common.md#meaningful-documentation The comment documents the parameters and the return value.

    • Constructs API request object from search values

      Parameters

      • values: Values

        Search values to include in request

      Returns Request

      Request object for the search API

      contracts/common.md#principled-implementation The function builds the API request from the values, so the same values drive the manual filter and the call.

      contracts/common.md#clear-and-simple-design One method from values to the request.

      contracts/common.md#prohibited-implementation-shortcuts It is caller code.

      contracts/common.md#meaningful-documentation The comment documents the parameter and the return value.

    • Extracts search values from a sample entity

      Parameters

      • entity: Entity

        The entity to extract search values from

      Returns Values

      Tuple of values used for searching

      contracts/common.md#principled-implementation The search values are read from a sampled entity, so the search is exercised with values that occur in the dataset.

      contracts/common.md#clear-and-simple-design One method with one entity argument.

      contracts/common.md#prohibited-implementation-shortcuts It is caller code.

      contracts/common.md#meaningful-documentation The comment documents the parameter and the return value.