Bun unit tests
Every Bun test file in Seed Exact, how many tests it holds, what it covers, and where its fixtures come from.

The Bun suite checks the TypeScript packages under src/ and the combined test server without building the app. It is the only app test layer that runs in GitHub Actions, and the Clipper worker runs it again before each TestFlight build.

Command

bun install --frozen-lockfile bun run test # package.json: "bun test src tools/test-server"

The script is defined in package.json. Bun is pinned to 1.4.2 by packageManager. Root level pnpm mobile:test wraps the same script. The real vault suite lives in .tests/ and is not matched by this command, see Real vault compatibility suite.

Test files

Counts are test( call sites in the file at this commit. Where a site sits inside a loop over a fixture, the number of tests Bun reports is higher; this is noted per file. The suite was not executed for this page.

File

Package

Tests

Covers

src/activity/tests/activity.test.ts

activity

17

Notify URL discovery, redirect refusal, signed request bytes, the ±20 s window against the mock, inbox grouping and read state, email verification states

src/agents/tests/agents.test.ts

agents

12

Envelope bytes equal to the React Native vector, URL normalisation and both endpoint layouts, secrets kept off remote plain HTTP, transcript replay, plans, token formatting, model choices

src/agents/tests/parity.test.ts

agents

11

Child runs by plan step, tool spawns, source chips, trigger context, structured parts, provider submissions (loops over provider types inside one test), fresh read clocks, stale HTTP tree versus stream

src/agents/tests/review.test.ts

agents

6

Request timestamps, non CBOR errors, non JSON frames, a source scan that forbids importing @ipld/dag-cbor or cborg in agents runtime code, and linear row joining for the turn budget

src/crypto/tests/crypto.test.ts

crypto

29 sites, 47 run (inferred)

Parity with the original clients: mnemonics (4 vectors, used by two loops), keys (6), comments (6), agents envelopes (2), vault states (2), plus changes, refs, profiles, notify bodies, seedkey files, HKDF, AEAD, envelopes, UUIDs

src/crypto/tests/review.test.ts

crypto

3

Explicit clocks: fractional milliseconds truncate, integer ts, non finite clocks refused

src/crypto/tests/vendor.test.ts

crypto

1

Runs tools/crypto-vectors/vendor.ts --out <tmp> and requires codecs.js byte identical to the vendored codecs (30 s timeout)

src/discuss/tests/load.test.ts

discuss

6

Refresh discards late results, reply parents from another document are refused before signing, corrupt key refusal, versions sent with a nested reply

src/discuss/tests/logic.test.ts

discuss

6

Summary counts on a captured home, thread ordering and nesting, reply targets, ids and Markdown

src/identity/tests/identity.test.ts

identity

12

Derivation vectors, the seed-keys store, name rules, .seedkey export and import, async derivation

src/identity/tests/storage.test.ts

identity

4

Unreadable bundles are never overwritten, malformed seeds refused without echoing key material

src/me/tests/logic.test.ts

me

11

checkImport, parseServerUrl, readAccount

src/me/tests/sources.test.ts

me

6

Import normalisation, idempotent reimport, concurrent imports, removal picks a valid current identity, request deadlines

src/profile/tests/profile.test.ts

profile

9 sites, 10 run

History heads and depth, prefill, refusals before any request, signed publish for a new and an existing profile (loop over [false, true]), failure handling

src/read/tests/cards.test.ts

read

4

Author face piles, comment counts, Query block style

src/read/tests/client.test.ts

read

4

The superjson decoder, including prototype pollution paths

src/read/tests/deep-links.test.ts

read

7

Route parameters that are whole URLs, site versus gateway URLs, typed sites read from their own server

src/read/tests/edge-cases.test.ts

read

11

Crossing inline marks, injection through block text, link encoding, active URL schemes

src/read/tests/load.test.ts

read

7

Refresh epochs per server, redirects and redirect cycles, retryable failures

src/read/tests/markdown.test.ts

read

21

Ids, inline Markdown, blocks to rows on captured documents, query and directory lists, dates

src/read/tests/open-site.test.ts

read

2

Typed site URL normalisation and refusals (each loops over inputs inside one test)

src/vault/tests/vault.test.ts

vault

27

VaultStore against the mock vault: local encryption, connect, retries after an aborted reply, 409 handling, tombstones, lock and logout, merge rules

tools/test-server/routes.test.ts

test server

5

Proxy Host header, CORS, the 403 for hosted notify paths, see The local test server

Total: 221 sites, about 240 tests when the loops expand (inferred from the fixture lengths, not from a run).

Fixtures

Fixture

Source

src/crypto/__tests__/fixtures/rn-client.json

Written by tools/crypto-vectors/generate.ts, which executes the original client sources with pinned time and randomness. Its provenance records the source commit and a SHA-256 per original file. See Parity vectors

src/agents/__tests__/envelope-vector.json

Written by tools/mock-agents/generate-vector.ts, which slices signAgentActionWith and sign out of the shared client sources and runs them with seed bytes 0 to 31 and Date.now fixed at 1794260000123

src/read/__tests__/fixtures/*.json (9 files: hypermedia-home, eric-home, ethosfera-home, seed-home, mcp, sentry, agent-unification, query-block-posts, all-descendants)

Real hyper.media responses, "captured 2026-11-09, GET /api/Resource?id=… etc." (markdown.test.ts)

src/discuss/__tests__/hypermedia-home-comments.json

A captured comment listing of the hyper.media home (test name: "the live hyper.media home")

Conventions

    Tests live in src/<pkg>/__tests__/*.test.ts and import bun:test.

    Secret storage is an in memory Map with get, set, forget, matching the SecretStore shape of Identity.

    Network is replaced per test: spyOn(globalThis, 'fetch'), a swapped globalThis.fetch restored in afterEach, or a mock's handle(req) called in process. Activity tests start the notify mock with Bun.serve on port 0.

    Clocks are passed in explicitly (NOW, now) wherever the code under test takes a time argument.

    One test needs the network: the first case in routes.test.ts proxies a real document read to hyper.media.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Comments