Skip to main content
Home
Works with
This package works with Cloudflare Workers, Node.js, Deno, Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score94%
License
MIT
Downloads31/wk
Published2 hours ago (2.3.2)

Testing utilities for Fedify applications

Functions

f
createContext<TContextData>(values:
Partial<Context<TContextData>>
& { url?: URL; data: TContextData; federation: Federation<TContextData>; }
): Context<TContextData>
No documentation available
f
createFederation<TContextData>(options?: { contextData?: TContextData; origin?: string; meterProvider?: any; tracerProvider?: any; }): TestFederation<TContextData>

Creates a mock Federation instance for testing purposes.

f
createInboxContext<TContextData>(args:
Partial<InboxContext<TContextData>>
& { url?: URL; data: TContextData; recipient?: string | null; federation: Federation<TContextData>; }
): TestInboxContext<TContextData>

Creates an InboxContext for testing purposes. Not exported - used internally only. Public API is in mock.ts

f
createOutboxContext<TContextData>(args:
Partial<OutboxContext<TContextData>>
& { url?: URL; data: TContextData; identifier: string; federation: Federation<TContextData>; }
): TestOutboxContext<TContextData>

Creates an OutboxContext for testing purposes. Not exported - used internally only. Public API is in mock.ts

f
createRequestContext<TContextData>(args:
Partial<RequestContext<TContextData>>
& { url: URL; data: TContextData; federation: Federation<TContextData>; }
): RequestContext<TContextData>

Creates a RequestContext for testing purposes. Not exported - used internally only. Public API is in mock.ts

f
getRandomKey(prefix: string): string
No documentation available
f
testMessageQueue<MQ extends MessageQueue>(
getMessageQueue: () => MQ | Promise<MQ>,
onFinally: (unnamed 0: { mq1: MQ; mq2: MQ; controller: AbortController; }) => Promise<void> | void,
options?: TestMessageQueueOptions
): Promise<void>

Tests a MessageQueue implementation with a standard set of tests.

f
waitFor(
predicate: () => boolean,
timeoutMs: number
): Promise<void>
No documentation available

Interfaces

  • Whether to test ordering key support. If true, tests will verify that messages with the same ordering key are processed in order, while messages with different ordering keys can be processed in parallel.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fedify/testing

Import symbol

import * as mod from "@fedify/testing";
or

Import directly with a jsr specifier

import * as mod from "jsr:@fedify/testing";