Skip to main content
Drives a vendor server the way Tappify does, so a route is tested without a running Tappify.

Parameters

target

TappifyHandlerOptions

defaults?

TestClientDefaults = {}

Returns

TestClient

Remarks

Pass the options object you hand createTappifyHandler, not the handler it returns: the client rebuilds the handler around testJwks and signs each call with a matching token. A built handler throws a TapError carrying TAP_TEST_TARGET_INVALID, because it would verify against the live Tappify key set and answer 401. Every call carries a fresh event id and the envelope Tappify sends, and every call but health a signed token, so the handler reads the same install, context, credentials and documents it will read in production. A route that answers an error rejects with a TapServerError carrying the code, message and status from the body, which is what a test asserts on; use raw when the status itself is the assertion. Every method calls the unprefixed path — /tappify/… — whatever basePath the options carry, so a basePath the handler strips off something else is not exercised here, and one that is itself a prefix of /tappify, such as /tap, makes every call 404 TAP_ROUTE_UNKNOWN. Reach a prefixed path through raw when that is what you need to cover.

Example