Remote / foldkit-remote/testing

TraceConfig

interface · packages/remote/src/testing.ts:156

interface TraceConfig<AppModel, Message> {
  readonly start: AppModel
  readonly update: ((
    model: AppModel,
    message: Message,
  ) => Update.Return<AppModel, Message, unknown>) &
    ((model: AppModel, message: RemoteMessage) => unknown)
  readonly active: Readonly<
    Record<string, ActiveSurface<AppModel> | SurfaceSource<AppModel>>
  >
  readonly options?: Omit<SubscriptionsOptions, 'now'>
  readonly now?: number
  readonly client: Client
  readonly outbox?: OutboxWiring<AppModel>
  readonly steps: ReadonlyArray<NoInfer<Message> | Respond>
}

Members

TraceConfig.start

property · packages/remote/src/testing.ts:158

readonly start: AppModel

The Model the trace starts from; its Subscriptions start at it.

TraceConfig.update

property · packages/remote/src/testing.ts:164

readonly update: ((
  model: AppModel,
  message: Message,
) => Update.Return<AppModel, Message, unknown>) &
  ((model: AppModel, message: RemoteMessage) => unknown)

The application's update. Remote's Subscriptions send it Remote's Messages, so its union must hold them. Its Commands other than Remote's are not run.

TraceConfig.active

property · packages/remote/src/testing.ts:171

readonly active: Readonly<
  Record<string, ActiveSurface<AppModel> | SurfaceSource<AppModel>>
>

The active record, as Data.subscriptions and Data.why take it.

TraceConfig.options

property · packages/remote/src/testing.ts:173

readonly options?: Omit<SubscriptionsOptions, 'now'>

As Data.subscriptions takes them; the trace's clock stands still, so it sets now.

TraceConfig.now

property · packages/remote/src/testing.ts:179

readonly now?: number

The time the trace's clock stands at, in milliseconds since the epoch: what every Command and Subscription it runs reads (Remote.now, an answer's date), and what the answers it asks for are given. Default 0.

TraceConfig.client

property · packages/remote/src/testing.ts:181

readonly client: Client

What answers each request once a step lets it go on: a fake, or a server's in-process client.

TraceConfig.outbox

property · packages/remote/src/testing.ts:188

readonly outbox?: OutboxWiring<AppModel>

The application's Data.outbox, when it makes durable writes: the trace starts from its restore over an empty store of its own, and runs its Subscriptions as one tab does (without Web Locks, and with no other tab to hear), so a durable write is stored and sent by it.

TraceConfig.steps

property · packages/remote/src/testing.ts:189

readonly steps: ReadonlyArray<NoInfer<Message> | Respond>