FakeNetwork

tcmts.atproto.testing.FakeNetwork · #tt5hk66k · interface

The fake network, running: its URL (every service is at it), and what it holds.

import type { AtprotoConfig } from "#codebase/tcmts/atproto";
import type { FakeRecord } from "#codebase/tcmts/atproto/testing";

export interface FakeNetwork {
  url: string;
  /** what `configure` takes to use it, in this process */
  config: AtprotoConfig;
  /** what another process (an app's server) needs in its environment to use it */
  env: Record<string, string>;
  /** stop it */
  close(): Promise<void>;
  records: Map<string, FakeRecord>;
  /** put a record straight in (to start from), as its author would have */
  seed(did: string, collection: string, rkey: string, value: Record<string, unknown>): FakeRecord;
  /** how many times someone has signed in with OAuth, and refreshed their tokens */
  oauth: { signIns: number; refreshes: number };
  /** sign this record's getRecord with some other key from now on, as a forged one would be */
  forge(uri: string): void;
  /** a record Jetstream says was written, that its repository doesn't hold */
  unsigned(did: string, collection: string, rkey: string, value: Record<string, unknown>): void;
}

uses

used by