Skip to content

@xtandard/links/testing

Testing utilities — @xtandard/links/testing.

  • createTestLinks: an in-memory core + redirect handler with a manual-flush ingestor and a memory analytics sink you can inspect.
  • clickRequest: build a realistic redirect request (user agent, geo headers, referrer, language).
  • USER_AGENTS: a few real user agents for tests and demos.
import { … } from "@xtandard/links/testing";
Name Summary
clickRequest Build a redirect request with realistic headers. Defaults: macOS Chrome, US.
createCollectingSink Create a CollectingSink.
createTestLinks An in-memory core + redirect handler for tests. defaultDomain defaults to "sho.rt". Background writes are awaited by TestLinks.flush.
Name Summary
ClickRequestOptions Options for clickRequest.
CollectingSink A sink that keeps every event in an array (exact reference aggregation).
TestLinks Result of createTestLinks.
TestLinksOptions Options for createTestLinks.
Name Summary
USER_AGENTS A few real user agents.