Testing
A fake Northlight your real OAuth2Client and Crouter talk to through fetch, for tests. Imported from @north-light/sdk/testing.
Exports of @north-light/sdk, read from the TypeScript compiler at build time. Types re-exported from @north-light/api are documented with that package.
Import these from @north-light/sdk/testing.
FAKE_TESTER_LIMIT
variable declared in testing/cloud.ts
The directory's cap on tester entries per app.
Prop
Type
FakeAccount
interface declared in testing/users.ts
The identifiers a person's account holds. Only email (when emailVerified) and phone match a tester entry.
Prop
Type
FakeAnswer
type declared in testing/cloud.ts
A scripted failure: 'unreachable' (fetch rejects), an HTTP status, or a FakeCloud.error(...) envelope (runtime only).
number | "unreachable" | FakeErrorFakeCall
interface declared in testing/cloud.ts
One runtime request the fake received.
Prop
Type
FakeCloud
class declared in testing/cloud.ts
A fake Northlight: the directory (discovery, refresh, JWKS) and each person's runtime, behind fetch.
Prop
Type
FakeCloudOptions
interface declared in testing/cloud.ts
Prop
Type
FakeDirectoryCall
interface declared in testing/cloud.ts
One directory request the fake received.
Prop
Type
FakeDirectoryOp
type declared in testing/cloud.ts
A directory operation.
"directory.discovery" | "directory.jwks" | "directory.token"FakeInterceptOp
type declared in testing/cloud.ts
What intercept / failNext / gate match: a runtime operation, '*' (every runtime operation), or a directory operation.
"*" | FakeDirectoryOp | FakeOpFakeMemoryDoc
interface declared in testing/users.ts
A document in the person's memory.
Prop
Type
FakeNotice
interface declared in testing/notices.ts
One notice attempt (cloud.notices).
Prop
Type
FakeOp
type declared in testing/cloud.ts
A runtime operation, named as the daemon's OPERATIONS table names it.
"grant.get" | "memory.get" | "memory.list" | "profile.list" | "provider.call" | "provider.tools" | "question.answer" | "question.get" | "run.cancel" | "run.delete" | "run.events" | "run.get" | "run.interrupt" | "run.list" | "run.message" | "run.rename" | "run.start" | "trace.get"FakeProvider
interface declared in testing/cloud.ts
providers.define input.
Prop
Type
FakeQuestion
interface declared in testing/run.ts
A question ask opens; defaults to one text slot answer.
Prop
Type
FakeRefusalCode
type declared in testing/users.ts
The directory's reasons for refusing a refresh token (the SDK's refusal table).
"app_in_testing" | "grant_removed" | "grant_revoked" | "grant_suspended" | "refresh_token_expired" | "refresh_token_reused" | "runtime_provisioning"FakeRun
class declared in testing/run.ts
One run the app started, and the test's handle on it.
Prop
Type
FakeRunEnding
type declared in testing/run.ts
How settle ends a run.
{ result: unknown; } | { declined: DeclinedResultDTO; } | { failure: 'canceled' | 'deadline_exceeded'; } | { runtimeError: string; }FakeRunMessage
interface declared in testing/run.ts
One message the run accepted (run.start message or run.message).
Prop
Type
FakeRunParams
interface declared in testing/run.ts
The run.start body as the fake received it.
Prop
Type
FakeRuns
interface declared in testing/cloud.ts
cloud.runs and user.runs: the runs in start order, and the responder for them.
Prop
Type
FakeScope
type declared in testing/users.ts
A scope the grant holds: a string is mode: 'always'.
string | { scope: string; mode: 'always' | 'ask'; }FakeTester
interface declared in testing/cloud.ts
A stored tester entry, normalized (email lowercased and trimmed).
Prop
Type
FakeTesterRef
type declared in testing/cloud.ts
A tester entry: an email (matched case-insensitively against a verified email) or a phone (E.164, matched against the confirmed phone).
{ email: string; phone?: never; } | { phone: string; email?: never; }FakeTesting
interface declared in testing/cloud.ts
Testing mode for the app this cloud serves: an unverified third-party app admits only its admin and up to 100 named testers.
Prop
Type
FakeToolHandler
type declared in testing/cloud.ts
A provider tool's handler; its return value is the call's result. Throw FakeCloud.error(...) for an envelope.
(input: { userId: string; arguments: Record<string, unknown>; signal: AbortSignal | null; }) => unknownFakeUser
interface declared in testing/users.ts
The test's handle on one person.
Prop
Type
GrantPatch
interface declared in testing/users.ts
grant.set / grant.restore patch.
Prop
Type
Intercept
type declared in testing/cloud.ts
Runs before an operation. It may await (a gate), act, or return a replacement answer.
(call: FakeCall | FakeDirectoryCall) => void | FakeAnswer | Promise<void | FakeAnswer>manualClock
function declared in testing/clock.ts
A ManualClock starting at startMs (default 2026-01-01T00:00:00Z). Pass it to FakeCloud as clock.
(startMs?: number) => ManualClockManualClock
interface declared in testing/clock.ts
A clock a test steps by hand: now() returns the same instant until advance(ms) moves it.
Prop
Type
Responder
type declared in testing/users.ts
Called after the fake answered a run.start, or a run.message with start_turn true; never for a replay.
(input: ResponderInput) => void | Promise<void>ResponderInput
interface declared in testing/users.ts
What a run's responder receives.
Prop
Type
RunNoticeOptions
interface declared in testing/notices.ts
Prop
Type