Skip to main content

SuggestionProviderControls

How the suggestion contract scripts a provider. A real adapter implements these by mocking its network layer, typically fetch.

This is an interface exported by @mapcairn/core/contracts, checked against version 0.2.0.

Signature​

import type { SuggestionProviderControls } from "@mapcairn/core/contracts";

interface SuggestionProviderControls

Methods​

hold​

hold(): void;

Keeps the next request pending until its signal aborts.

respondWithOversizeAnswer​

respondWithOversizeAnswer(): void;

Makes every later request read an answer larger than whatever limit the provider applies to the size of an answer. A provider is free to choose its limit (the subject can lower it so the answer stays small), and the suite requires only that the answer is refused.

willFail​

willFail(kind: SearchErrorKind): void;

Makes every later request fail the way kind describes.

  • kind (SearchErrorKind)

willReturn​

willReturn(results: readonly SearchResult[]): void;

Makes the provider answer every later suggest with these results.

  • results (readonly SearchResult[])

See also​

Source: packages/core/src/contracts/suggestionProvider.contract.ts:16