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"

Source

BASE_URL

Signature

declare const BASE_URL: "https://workos.test"

Source

CLIENT_ID

Signature

declare const CLIENT_ID: "client_test"

Source

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>
}

Source

FakeWorkOS (type alias)

Signature

type FakeWorkOS = Effect.Success<ReturnType<typeof make>>

Source

ISSUER

Signature

declare const ISSUER: "https://workos.test/user_management/client_test"

Source

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
>

Source

testConfig

Signature

declare const testConfig: (overrides?: Partial<WorkOSConfig>) => WorkOSConfig

Source


This site uses Just the Docs, a documentation theme for Jekyll.