testing/audit_completeness.ts

Composable audit log completeness test suite.

Verifies that every auth mutation route produces the expected audit log event. Uses the real middleware stack and database — audit events are verified by querying the audit_log table after each request.

Bootstrap is excluded because it requires filesystem token state that create_test_app does not provide. Bootstrap audit logging is tested separately in bootstrap_account.db.test.ts.

Declarations
#

2 declarations

view source

AuditCompletenessTestOptions
#

testing/audit_completeness.ts view source

AuditCompletenessTestOptions

session_options

Session config for cookie-based auth.

type SessionOptions<string>

create_route_specs

Route spec factory — same one used in production.

type (ctx: AppServerContext) => Array<RouteSpec>

rpc_endpoints

RPC endpoint specs — the source RpcAction arrays. Required; the admin role_grant flow is RPC-only and the suite hard-fails without it.

Accepts either an array (eager) or a factory (ctx: AppServerContext) => Array<RpcEndpointSpec> — the factory form is required when action handlers must close over the per-test ctx.app_settings / ctx.deps (e.g. exercising app_settings_update). The factory must return the same endpoint path regardless of ctx — it is invoked once at setup with a stub ctx for path lookup and again per-test by create_app_server for live dispatch.

app_options

Optional overrides for AppServerOptions.

db_factories

Database factories to run tests against. Default: pglite only.

type Array<DbFactory>

describe_audit_completeness_tests
#

testing/audit_completeness.ts view source

(options: AuditCompletenessTestOptions): void

Composable audit log completeness test suite.

Verifies that every auth mutation route produces the correct audit log event type. Exercises routes via HTTP requests against a real PGlite database, then queries the audit_log table to verify events.

options

returns

void

throws

  • Error - at setup time when `options.rpc_endpoints` is empty — the

Depends on
#