testing/cross_backend/revocation_drivers.ts

The account-wide revocations the cross-process WS and SSE round-trip suites both close a live connection on — one table, so a revocation added here is covered on both transports.

Each row drives one revocation of a target account's credentials and asserts it succeeded; the suite opens the target's connections first and asserts their close after. describe_cross_process_ws_tests and describe_cross_process_sse_tests iterate create_account_revocations. The revocations whose close is narrower than the account (one session, one token, a cap eviction) or that a suite drives differently (session revoke-all, account delete) stay in their suites.

The drivers are exported on their own for a consumer suite that closes a transport of its own on the same revocations.

view source

Declarations
#

6 declarations

AccountRevocation
#

testing/cross_backend/revocation_drivers.ts view source

AccountRevocation import type {AccountRevocation} from '@fuzdev/fuz_app/testing/cross_backend/revocation_drivers.js';

One account-wide revocation, as a row both transport suites iterate.

label

Names the revocation in a case name and a failure message.

type string

readonly

slug

Distinguishes the target account's username — unique in the table, and short enough that a suite's prefix keeps the username within Username.

type string

readonly

gate

Whether the backend serves the revocation (beyond rpc_path, which every row needs).

type boolean

readonly

revoke

Revoke target's credentials and assert the revocation succeeded. target must have been created with DEFAULT_TEST_PASSWORD, which the password-change row presents.

type (fixture: TestFixture, target: TestAccount): Promise<void>

readonly

fixture

target

returns Promise<void>

AccountRevocationsOptions
#

testing/cross_backend/revocation_drivers.ts view source

AccountRevocationsOptions import type {AccountRevocationsOptions} from '@fuzdev/fuz_app/testing/cross_backend/revocation_drivers.js';

Configuration for create_account_revocations.

capabilities

Backend capability flags; account_purge gates on account_lifecycle.

type BackendCapabilities

readonly

rpc_path

RPC endpoint path the admin and keeper revocations are sent to.

type string

readonly

logout_path

REST logout route path.

type string

readonly

password_path

REST password-change route path.

type string

readonly

create_account_revocations
#

testing/cross_backend/revocation_drivers.ts view source

(options: AccountRevocationsOptions): readonly AccountRevocation[] import {create_account_revocations} from '@fuzdev/fuz_app/testing/cross_backend/revocation_drivers.js';

The account-wide revocations that close every connection of the target account: admin_token_revoke_all, POST /logout, POST /password, and account_purge (gated on capabilities.account_lifecycle).

options

the backend's capabilities and route paths

returns

readonly AccountRevocation[]

the revocation rows, in a stable order

cross_account_purge
#

testing/cross_backend/revocation_drivers.ts view source

(fixture: TestFixture, rpc_path: string, account_id: string): Promise<void> import {cross_account_purge} from '@fuzdev/fuz_app/testing/cross_backend/revocation_drivers.js';

Purge account_id over the keeper's daemon token (account_purge), asserting success. The request carries no Origin, as a daemon-token caller's wouldn't.

fixture

the per-test fixture

rpc_path

the RPC endpoint path

type string

account_id

the account to purge

type string

returns

Promise<void>

cross_admin_token_revoke_all
#

testing/cross_backend/revocation_drivers.ts view source

(fixture: TestFixture, rpc_path: string, account_id: string): Promise<void> import {cross_admin_token_revoke_all} from '@fuzdev/fuz_app/testing/cross_backend/revocation_drivers.js';

Revoke every API token of account_id over the keeper's admin session (admin_token_revoke_all), asserting success.

fixture

the per-test fixture; its keeper holds the admin role

rpc_path

the RPC endpoint path

type string

account_id

the account whose tokens to revoke

type string

returns

Promise<void>

cross_post_as
#

testing/cross_backend/revocation_drivers.ts view source

(fixture: TestFixture, account: TestAccount, path: string, body: unknown): Promise<void> import {cross_post_as} from '@fuzdev/fuz_app/testing/cross_backend/revocation_drivers.js';

POST a JSON body to a REST route on account's session, asserting 200.

fixture

the per-test fixture whose fresh transport carries the request

account

the account whose session cookie authenticates it

path

the REST route path

type string

body

the JSON request body

type unknown

returns

Promise<void>

Depends on
#

Imported by
#