testing/token_scope_fixtures.ts

Token-scope documents built to a size, for the tests of MAX_TOKEN_SCOPE_BYTES — hono-free, so the cross-process suites import it.

The cap counts UTF-8 bytes of a document's compact JSON on both spines. token_scope_methods_at_bytes builds the method list whose methods document is exactly a given size, the same list the Rust spine's tests build, so a boundary pinned on one spine is the boundary on the other.

view source

Declarations
#

2 declarations

token_scope_methods_at_bytes
#

testing/token_scope_fixtures.ts view source

(bytes: number, filler: string): string[] import {token_scope_methods_at_bytes} from '@fuzdev/fuz_app/testing/token_scope_fixtures.js';

Method names whose methods scope document is exactly bytes compact UTF-8 bytes: account_token_list (so a token over it can list its own account's tokens), names scope_cap_<i>_<filler> while they fit, and an ASCII pad of xs. A multibyte filler makes a document far under bytes in UTF-16 code units. The names hold no : or ,, so the printed jsonb text has exactly one more byte per separator.

bytes

the compact document's size; at least that of the first name alone

type number

filler

the tail of every name but the first and the pad

type string

returns

string[]

distinct method names, sorted, as the Rust spine stores them

token_scope_methods_bytes
#

testing/token_scope_fixtures.ts view source

(methods: string[]): number import {token_scope_methods_bytes} from '@fuzdev/fuz_app/testing/token_scope_fixtures.js';

The UTF-8 byte length of the compact JSON of a methods scope over methods, the unit MAX_TOKEN_SCOPE_BYTES counts. Method order changes the document, not its length.

methods

the scope's method names

type string[]

returns

number

the byte length of JSON.stringify(token_scope_methods(methods))

Depends on
#

Imported by
#