Skip to main content

Module testing

Module testing 

Source

Modules§

assertions
Test assertion macros and helpers.
context
Test context builders for all Forge function types.
db
Database provisioning for tests.
mock_dispatch
Mock dispatchers for testing job and workflow dispatch.
mock_email
Mock email sender for testing.
mock_http
HTTP mocking utilities for testing.

Structs§

DispatchedJob
Record of a dispatched job.
IsolatedTestDb
A test database scoped to a single test. Call cleanup() to drop it immediately, or rely on future test runs to clean up orphaned databases.
MockEmailSender
Records sent emails for assertion in tests.
MockHttp
Mock HTTP client for testing.
MockHttpBuilder
MockJobDispatch
Records dispatched jobs for later verification.
MockRequest
Mock HTTP request.
MockResponse
Mock HTTP response.
MockWorkflowDispatch
Records started workflows for later verification.
SentEmail
A recorded email send.
StartedWorkflow
Record of a started workflow.
TestCronContext
Test context for cron functions.
TestCronContextBuilder
TestDaemonContext
Test context for daemon functions.
TestDaemonContextBuilder
TestDatabase
Database access for tests.
TestJobContext
Test context for job functions.
TestJobContextBuilder
Builder for TestJobContext.
TestMcpToolContext
Test context for MCP tool functions.
TestMcpToolContextBuilder
TestMutationContext
Test context for mutation functions with mock dispatch and optional DB access.
TestMutationContextBuilder
Builder for TestMutationContext.
TestProgressUpdate
Progress update recorded during testing.
TestQueryContext
Test context for query functions with optional DB access.
TestQueryContextBuilder
Builder for TestQueryContext.
TestWebhookContext
Test context for webhook functions.
TestWebhookContextBuilder
TestWorkflowContext
Test context for workflow functions.
TestWorkflowContextBuilder
Builder for TestWorkflowContext.

Constants§

DEFAULT_JOB_TIMEOUT
DEFAULT_TEST_TIMEOUT
DEFAULT_WORKFLOW_TIMEOUT

Functions§

assert_contains
Assert that an array contains an element matching a predicate.
assert_json_matches
Assert that a value matches a JSON pattern (partial matching).