createTestLinks
function createTestLinks(options?): TestLinks;Defined in: src/testing.ts:98
An in-memory core + redirect handler for tests. defaultDomain defaults to
"sho.rt". Background writes are awaited by TestLinks.flush.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
TestLinksOptions |
Returns
Section titled “Returns”Example
Section titled “Example”const { core, redirects, flush, events } = createTestLinks();const link = await core.createLink({ url: "https://example.com", slug: "x" });const res = await redirects.fetch(clickRequest("https://sho.rt/x"));await flush(); // events now holds the click