tcmts.cli.test.e2e.examples

Types

FakeAccount type
An account on the fake network.
FakeAtproto type
The fake network, running: its URL (every service is at it), and what it holds.
FakeRecord type
A record the fake network holds.
Keep type
What withChildren hands a test: keeps a process, to kill when the test ends.

Server

env () => ProcessEnv
exampleDir (files: Record<string, string | Uint8Array<ArrayBufferLike>>) => string
An example's files, as the codebase keeps them, written to a directory of their own: its setup script runs from there. By path in the example.
hashOf (name: string, root: string) => string
legacyMultibase (compressed: Uint8Array<ArrayBufferLike>) => string
A secp256k1 public key (compressed, as `exportPublicKey("raw")` gives it) as a legacy DID document writes it: uncompressed, in base58btc multibase (`z…`), for an `EcdsaSecp256k1VerificationKey2019` method.
signedRecordCar (did: string, path: string, value: Record<string, unknown>, key: { sign(data: Uint8Array<ArrayBuffe…
A repository's proof of one record, as `com.atproto.sync.getRecord` sends it: a CAR whose root is a commit signed with `key`, over a tree of the one record at `path` (`collection/rkey`).
startApp (keep: Keep, cwd: string, app: string) => Promise<string>
Start `tcm start <app>` in `cwd` on a free port; resolves with its URL.
startFakeAtproto (keep: Keep, accounts: FakeAccount[]) => Promise<FakeAtproto>
The AT Protocol as the userinput example uses it, on one local server, so its end-to-end test needs no network: Constellation's backlinks (`blue.microcosm.links.*`, `/links/all`), Slingshot's records and identities, the appview's profiles and typeahead, the image service, a PLC directory, and a PDS for each account (password sessions, records, blobs) with its OAuth authorization server (PAR, authorize, token; DPoP-bound tokens, nonces asked for, PKCE checked; authorizing signs in as the login hint at once, as if they'd said yes), its records signed (`com.atproto.sync.getRecord`'s CAR, with each account's `#atproto` key in its DID document: a P-256 `Multikey`, or a legacy uncompressed secp256k1 key, `legacyKey`), a relay's `listReposByCollection`, the appview's follows (`app.bsky.graph.getFollows`, from `app.bsky.graph.follow` records), and a Jetstream (v2's `subscribeEvents`, a websocket) of every record written. Backlinks are every `{ uri }` a record holds, at its path (`subject.uri`). Allows any origin.
staticHost (root: string, port?: number) => Promise<{ url: string; port: number; close: () => Promise<void>; }>
Serve a directory as a static host does: its files, and nothing else. Resolves with its URL and a way to stop it; on `port`, if given (a site that comes back where it was, as after a deploy).
wsFrame (text: string) => Buffer<ArrayBufferLike>
A websocket text frame, as a server sends it (unmasked).

Tests

testGeometryExample () => void
the geometry example: two packages, their releases, a contribution, and what's next
testNotesExample () => Promise<void>
the notes example: React server components with no directives, in a browser
testPollsExample () => Promise<void>
the polls example builds, passes its tests, and runs in a browser
testRemindersExample () => Promise<void>
the reminders example: a local-first PWA built as a static site, in a browser: its data on the device, opened with no server at all, and a new version found and taken by itself, the data kept
testUserinputExample () => Promise<void>
the userinput example: an AT Protocol client, against a fake network (no internet), in Chrome. It reads a space's board and a discussion as the moderation rules say, signs in, replies, votes and posts: records written to the person's own repo, pointing at what they're about.