Remote / foldkit-remote/testing

Trace

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

const Trace = { run, tags, regressions }

Its type

interface Trace<AppModel, Message> {
  readonly start: AppModel
  readonly entries: ReadonlyArray<TraceEntry<AppModel, Message>>
  readonly pending: ReadonlyArray<string>
  readonly why: (
    model: AppModel,
    read: Projection<AppModel, RemoteData<unknown>>,
  ) => ReadWhy
  readonly timeline: (
    reads: Readonly<Record<string, Projection<AppModel, RemoteData<unknown>>>>,
  ) => ReadonlyArray<ReadStep<Message>>
}

What Trace.run recorded.

In the guides

Members

Trace.run

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

run<AppModel, Message>(
  Data: RemoteDomain<AppModel, any, any, any, any>,
  config: TraceConfig<AppModel, Message>,
): Promise<Trace<AppModel, Message>>

Trace.tags

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

tags<AppModel>(
  trace: Trace<AppModel, unknown>,
  read: Projection<AppModel, RemoteData<unknown>>,
): ReadonlyArray<Tag>

What the read showed across the trace, the start first: each change of tag, so a one-Message blink reads ['Ready', 'Loading', 'Ready'].

Trace.regressions

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

regressions<AppModel, Message>(
  trace: Trace<AppModel, Message>,
  reads: Readonly<Record<string, Projection<AppModel, RemoteData<unknown>>>>,
): ReadonlyArray<Regression<Message>>

Every time a read that showed a value (Ready, Refreshing) stopped showing it without a reason a reader can see: it read Loading or Initial, or Failed without the value (#234). NotFound is a reason: the server said the row is gone.