Skip to main content

Built and signed on GitHub Actions

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 Score100%•
License
MIT
•
Downloads126/wk
•
Published6 hours ago (2.4.1)

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; documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; verifyPortableObject?: PortableObjectVerifier; }): 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
testKvStore<KV extends KvStore>(
getKvStore: () => KV | Promise<KV>,
onFinally: (arg_0: { store: KV; }) => Promise<void> | void,
options?: TestKvStoreOptions
): Promise<void>

Tests a KvStore implementation with a standard set of tests.

f
testMessageQueue<MQ extends MessageQueue>(
getMessageQueue: () => MQ | Promise<MQ>,
onFinally: (arg_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

  • testCas: boolean

    Whether to test compare-and-swap support. By default, these tests run when the store implements KvStore.cas.

  • testTtl: boolean

    Whether to test time-to-live support. true by default.

  • 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@^2.4.1";