Skip to content

API Reference / @gtkx/testing / buildQueries

Variable: buildQueries ​

const buildQueries: <Args>(queryAllBy, getMultipleError, getMissingError) => BuiltQueries<Args>

Defined in: packages/testing/dist/build-queries.d.ts:31

Derives the queryBy, getAllBy, getBy, findAllBy, and findBy variants of a query family from the family's queryAllBy function, mirroring DOM Testing Library's buildQueries. The family name used when suggesting a better query comes from queryAllBy.name.

Type Parameters ​

Args ​

Args extends unknown[]

Parameters ​

queryAllBy ​

QueryAllBy<Args>

Finds every widget the family matches.

getMultipleError ​

MultipleErrorBuilder<Args>

Builds the error thrown when a single-match variant finds more than one widget.

getMissingError ​

MissingErrorBuilder<Args>

Builds the error thrown when a required match is missing.

Returns ​

BuiltQueries<Args>

The variants, in the order [queryBy, getAllBy, getBy, findAllBy, findBy].

Released under the MPL-2.0 License.