@xtandard/entitlements/testing
Test helpers: an in-memory engine with a controllable clock, so tests can cross period boundaries, trial ends and grant expiries deterministically.
import { createTestEntitlements } from "@xtandard/entitlements/testing";
const { ent, clock } = createTestEntitlements({ catalog, now: "2026-11-30T23:00:00Z" });await ent.consume("org_1", "api_calls", 1000);clock.advance("2h"); // new month → fresh allowanceimport { … } from "@xtandard/entitlements/testing";Functions
Section titled “Functions”| Name | Summary |
|---|---|
createTestClock |
Create a TestClock starting at start (default: real now). |
createTestEntitlements |
An engine on in-memory storage + counters with a test clock, collecting usage, threshold and hook events. User-supplied listeners still run. |
Interfaces
Section titled “Interfaces”| Name | Summary |
|---|---|
TestClock |
A controllable clock. |
TestEntitlements |
What createTestEntitlements returns. |
Type aliases
Section titled “Type aliases”| Name | Summary |
|---|---|
TestEntitlementsOptions |
Options for createTestEntitlements. |