Skip to main content

Setup

Import testing utilities from @jelou/functions/testing:

createMockContext(overrides?)

Creates a context with sensible defaults for testing.

createMockCronContext(expression, overrides?, cronName?)

Creates a context with isCron: true and trigger.type: "cron".

createMockEventContext(eventName, overrides?)

Creates a context with isEvent: true and trigger.type: "event".

createMockRequest(body?, options?)

Creates a standard Web Request object.

createMockPlatformRequest(token, body?, options?)

Creates a Request with the X-Jelou-Token header. Useful for testing functions that receive requests authenticated with runtime tokens.

createMockJelouClient(options?)

Creates a mock messaging client with call recording.

Custom results

Reset between tests

createMockMemoryClient(options?)

Creates a mock memory client with an in-memory store.

Inspect calls

Reset between tests

Full example

index.test.ts

createMockApp(tools, config?)

Creates a mock EdgeApp for testing multi-tool functions.
Run tests with Deno: