Skip to content

Class: CursorTokens

Defined in: src/testing/pagination.ts:33

Hands out cursors a client cannot derive.

A cursor that encodes its own offset (offset:40) lets a buggy consumer fabricate the next one and still page correctly, so tests can't tell "echoes the server's cursor" from "invents one". Tokens here are opaque counter values resolved through this map — echoing what the server sent is the only way to advance. Counter, not random, so runs stay reproducible.

Constructors

Constructor

ts
new CursorTokens(): CursorTokens;

Returns

CursorTokens

Methods

issue()

ts
issue(offset): string;

Defined in: src/testing/pagination.ts:39

Mint a cursor pointing at offset

Parameters

ParameterType
offsetnumber

Returns

string


offsetOf()

ts
offsetOf(cursor): number;

Defined in: src/testing/pagination.ts:46

The offset a cursor refers to; unknown cursors start from the top

Parameters

ParameterType
cursorstring | undefined

Returns

number