Remote / foldkit-remote/testing

Respond

namespace · packages/remote/src/testing.ts:65

const Respond = { query, read, mutation, all }

Its type

type Respond = Release

The steps that answer what the application asked, each in the order the test puts it.

In the guides

Members

Respond.query

function · packages/remote/src/testing.ts:70

query(
  ref: QueryRef<string, unknown>,
  options?: {
    readonly fail?: RemoteQueryError | RemoteUnauthenticated
  },
): Respond

Answers the oldest held query of ref's connection (any window of it) with what client returns for it, or fails it with fail.

Respond.read

function · packages/remote/src/testing.ts:83

read(
  entity: EntityLike,
  id: string,
  options?: {
    readonly fail?:
      RemoteReadError | RemoteProtocolError | RemoteUnauthenticated
  },
): Respond

Answers the oldest held read batch that asks for this row. A batch is answered whole, other rows included, as the server answers it.

Respond.mutation

function · packages/remote/src/testing.ts:96

mutation(
  mutation: MutationDescriptor<string, any, any>,
  options?: {
    readonly fail?:
      | RemoteMutationError
      | RemoteForbidden
      | RemoteUnauthenticated
      | RemoteUnreachable
  },
): Respond

Answers the oldest held request of this mutation.

Respond.all

const · packages/remote/src/testing.ts:115

all: Release

Answers every held request, then every request those answers lead to, until none is held: none at all, when nothing is.