testing/cross_backend/role_grant_cross_helpers.ts

Role-grant fixtures for the cross-process suites — a pending offer, and an active grant materialized through the real offer + accept handlers — shared by the suites that need a grant to revoke (describe_role_grant_offer_notification_ws_tests, describe_ws_role_gated_cross_tests).

Both drive the standard role-grant-offer RPC actions over the fixture's HTTP transport, as the keeper unless a grantor is given.

view source

Declarations
#

3 declarations

create_active_role_grant
#

testing/cross_backend/role_grant_cross_helpers.ts view source

(fixture: TestFixtureBase, recipient: TestAccount, options?: RoleGrantFixtureOptions): Promise<string> import {create_active_role_grant} from '@fuzdev/fuz_app/testing/cross_backend/role_grant_cross_helpers.js';

Materialize an active global grant of role on recipient through a fresh keeper offer and the recipient's accept, returning its role_grant_id — the handle role_grant_revoke keys on. Idempotent on a grant the account already holds: the accept returns that grant's id.

fixture

the per-test fixture

recipient

the account that accepts the offer

options

the role and the RPC path

default {}

returns

Promise<string>

the active grant's id

create_pending_role_grant_offer
#

testing/cross_backend/role_grant_cross_helpers.ts view source

(fixture: TestFixtureBase, to_account_id: string, grantor_headers?: Record<string, string>, options?: RoleGrantFixtureOptions): Promise<...> import {create_pending_role_grant_offer} from '@fuzdev/fuz_app/testing/cross_backend/role_grant_cross_helpers.js';

Create a fresh pending offer of role from grantor_headers (defaults to the keeper) to to_account_id, returning the created offer.

fixture

the per-test fixture

to_account_id

the recipient account

type string

grantor_headers

the grantor's session headers; the keeper's when omitted

type Record<string, string>
default fixture.create_session_headers()

options

the role and the RPC path

default {}

returns

Promise<{ id: string; }>

the created offer

RoleGrantFixtureOptions
#

testing/cross_backend/role_grant_cross_helpers.ts view source

RoleGrantFixtureOptions import type {RoleGrantFixtureOptions} from '@fuzdev/fuz_app/testing/cross_backend/role_grant_cross_helpers.js';

Options for the role-grant fixtures.

role?

The role to offer. Default ROLE_ADMIN, the one builtin admin-grantable role.

type string

readonly

rpc_path?

The JSON-RPC endpoint path. Default SPINE_RPC_PATH.

type string

readonly

Depends on
#

Imported by
#