Remote / foldkit-remote/testing

Walk

namespace · packages/remote/src/walk.ts:303

const Walk = { cases, run, states }

In the guides

Members

Walk.cases

function · packages/remote/src/walk.ts:106

cases<
  Model,
  Message extends {
    readonly _tag: string
  },
>(): <const Table extends Tables<Model, Message>>(
  table: Table & {
    readonly [Tag in Exclude<keyof Table, Message['_tag']>]: never
  },
) => WalkCases<Model, Message, Table>

The cases of a walk, from generators named per Message variant. A variant without an entry, or an entry for no variant, does not compile, so a new Message cannot be left out of the walk.

Walk.run

function · packages/remote/src/walk.ts:152

run<Model, Message>(options: WalkOptions<Model, Message>): Promise<WalkResult>

Walk.states

function · packages/remote/src/walk.ts:282

states<A, I>(
  schema: Schema.Codec<A, I>,
  options: {
    readonly count: number
    readonly seed: number
  },
): ReadonlyArray<Start<A>>

Starts for a walk, derived from a Schema: values built over its encoded side by kind (a literal or union picks a member, a number comes from a small pool, a string from one holding a surrogate pair, an array has none, one or two items, structs and records recurse), each decoded through the Schema so its checks refuse what they should. A refused value is drawn again, up to a bound. The same seed gives the same starts.

Unknown and Any draw from a few values of any JSON kind. A kind with no generator (a Declaration such as Option, a recursive Schema, a template literal) throws here, naming the kind and its path: a start list that silently skipped it would test a smaller space than it claims. Give such a Schema's states by hand.