FakeWorkOS.fixtures.ts overview
An in-memory WorkOS User Management API for the suites: the endpoints this package calls, RS256 access tokens signed with a test key and its JWKS, and single-use refresh tokens. Its wire shapes follow the WorkOS Node SDK’s (de)serializers, which is what “the published package’s source” means for the details the suites pin.
Exports Grouped by Category
utils
API_KEY
Signature
declare const API_KEY: "sk_test_secret"
BASE_URL
Signature
declare const BASE_URL: "https://workos.test"
CLIENT_ID
Signature
declare const CLIENT_ID: "client_test"
FakeOptions (interface)
Signature
export interface FakeOptions {
/** Answer `email_verification_required` to a password grant for an unverified user. */
readonly requireEmailVerification?: boolean
/** Access-token lifetime in seconds (default 300). */
readonly accessTokenTtl?: number
/** Roles and permissions put in every access token. */
readonly role?: string
readonly roles?: ReadonlyArray<string>
readonly permissions?: ReadonlyArray<string>
}
FakeWorkOS (type alias)
Signature
type FakeWorkOS = Effect.Success<ReturnType<typeof make>>
ISSUER
Signature
declare const ISSUER: "https://workos.test/user_management/client_test"
make
The fake. Build it once per test: its state is its own.
Signature
declare const make: (
options?: FakeOptions | undefined
) => Effect.Effect<
{
layer: Layer.Layer<HttpClient.HttpClient, never, never>
calls: Array<RecordedCall>
addUser: (email: string, password: string | undefined, fields?: Partial<WireUser>) => Effect.Effect<WireUser>
sign: (claims: Schema.JsonObject) => Effect.Effect<string, never, never>
sessionStatus: (id: string | undefined) => "active" | "inactive" | undefined
activeSessionIds: () => Array<string>
magicCode: (email: string) => string | undefined
resetTokens: () => Array<string>
authorizationCode: (userId: string, challenge: string) => string
impersonateNext: (email: string, reason: string | null) => void
},
never,
never
>
testConfig
Signature
declare const testConfig: (overrides?: Partial<WorkOSConfig>) => WorkOSConfig