Skip to main content

RoutingProviderControls

How the routing 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 { RoutingProviderControls } from "@mapcairn/core/contracts";

interface RoutingProviderControls

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: ScriptedRoutingFailure): void;

Makes every later request fail the way kind describes.

  • kind (ScriptedRoutingFailure)

willReturnArea​

willReturnArea(result: ReachableAreaResult): void;

Makes every later reachableArea answer with these areas.

  • result (ReachableAreaResult)

willReturnRoute​

willReturnRoute(result: RouteResult): void;

Makes every later route answer with this route.

  • result (RouteResult)

See also​

Source: packages/core/src/contracts/routingProvider.contract.ts:23