Class: FakePiefedInstance
Defined in: src/testing/piefed/index.ts:249
FakeInstance for PieFed whose default routes are derived, per request, from the semantic seed store — tests describe what exists, not which endpoint returns it:
const alex = fake.seed.person({ name: "alex" });
fake.seed.post({ name: "Hello **world**", creator: alex });Derived: site, post list/detail, comment list, community, person, unread counts, the notification fan-out (replies/mentions/private messages), and mark-as-read writes (which mutate the seed store). Use mock() for error injection or endpoints outside this set. Wire-level builders stay available on build.
Extends
Constructors
Constructor
new FakePiefedInstance(__namedParameters?): FakePiefedInstance;Defined in: src/testing/piefed/index.ts:270
Parameters
| Parameter | Type |
|---|---|
__namedParameters | FakePiefedInstanceOptions |
Returns
FakePiefedInstance
Overrides
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
host | readonly | string | - | FakeInstance.host | src/testing/FakeInstance.ts:149 |
origin | readonly | string | - | FakeInstance.origin | src/testing/FakeInstance.ts:151 |
software | readonly | object | - | FakeInstance.software | src/testing/FakeInstance.ts:153 |
software.name | public | string | - | - | src/wellknown.ts:19 |
software.version | public | string | - | - | src/wellknown.ts:20 |
fetch | readonly | { (input, init?): Promise<Response>; (input, init?): Promise<Response>; } | fetch-compatible adapter. Prefer clientOptions() when constructing a ThreadiverseClient; use this directly to install a global fetch mock. Unrouted requests and { abort } responses throw TypeError, like a real network failure. | FakeInstance.fetch | src/testing/FakeInstance.ts:218 |
build | readonly | object | Wire-format builders bound to this instance's host | - | src/testing/piefed/index.ts:251 |
build.commentListResponse | public | (comments, nextPage) => object | - | - | src/testing/piefed/builders.ts:357 |
build.commentReplyView | public | (over) => object | - | - | src/testing/piefed/builders.ts:358 |
build.commentView | public | (over) => object | - | - | src/testing/piefed/builders.ts:359 |
build.community | public | (over) => object | - | - | src/testing/piefed/builders.ts:360 |
build.communityResponse | public | (over) => object | - | - | src/testing/piefed/builders.ts:361 |
build.communityView | public | (over) => object | - | - | src/testing/piefed/builders.ts:362 |
build.getSiteResponse | public | (over) => object | - | - | src/testing/piefed/builders.ts:363 |
build.person | public | (over) => object | - | - | src/testing/piefed/builders.ts:364 |
build.personView | public | (subject) => object | - | - | src/testing/piefed/builders.ts:365 |
build.post | public | (over) => object | - | - | src/testing/piefed/builders.ts:366 |
build.postListResponse | public | (posts, nextPage) => object | - | - | src/testing/piefed/builders.ts:367 |
build.postView | public | (over) => object | - | - | src/testing/piefed/builders.ts:368 |
build.privateMessageListResponse | public | (private_messages) => object | - | - | src/testing/piefed/builders.ts:369 |
build.privateMessageView | public | (over) => object | - | - | src/testing/piefed/builders.ts:370 |
build.repliesResponse | public | (replies, nextPage) => object | - | - | src/testing/piefed/builders.ts:371 |
build.userResponse | public | (subject) => object | - | - | src/testing/piefed/builders.ts:372 |
callsTo | readonly | <Operation>(operation) => PayloadOf<object[Operation]>[] | Canonical payloads of the requests an operation received | - | src/testing/piefed/index.ts:254 |
on | readonly | object | Override an operation's response (canonical { error } supported) | - | src/testing/piefed/index.ts:257 |
on.createComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:63 |
on.createPost | public | (responder) => void | - | - | src/testing/piefed/index.ts:71 |
on.createPrivateMessage | public | (responder) => void | - | - | src/testing/piefed/index.ts:80 |
on.deleteComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:84 |
on.deletePost | public | (responder) => void | - | - | src/testing/piefed/index.ts:88 |
on.editComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:92 |
on.editPost | public | (responder) => void | - | - | src/testing/piefed/index.ts:100 |
on.followCommunity | public | (responder) => void | - | - | src/testing/piefed/index.ts:109 |
on.getComments | public | (responder) => void | - | - | src/testing/piefed/index.ts:113 |
on.getCommunity | public | (responder) => void | - | - | src/testing/piefed/index.ts:128 |
on.getPersonDetails | public | (responder) => void | - | - | src/testing/piefed/index.ts:134 |
on.getPost | public | (responder) => void | - | - | src/testing/piefed/index.ts:140 |
on.getPosts | public | (responder) => void | - | - | src/testing/piefed/index.ts:146 |
on.getSite | public | (responder) => void | - | - | src/testing/piefed/index.ts:161 |
on.getUnreadCount | public | (responder) => void | - | - | src/testing/piefed/index.ts:162 |
on.likeComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:163 |
on.likePost | public | (responder) => void | - | - | src/testing/piefed/index.ts:170 |
on.login | public | (responder) => void | - | - | src/testing/piefed/index.ts:177 |
on.markPostAsRead | public | (responder) => void | - | - | src/testing/piefed/index.ts:184 |
on.resolveObject | public | (responder) => void | - | - | src/testing/piefed/index.ts:188 |
on.saveComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:194 |
on.savePost | public | (responder) => void | - | - | src/testing/piefed/index.ts:198 |
on.search | public | (responder) => void | - | - | src/testing/piefed/index.ts:199 |
once | readonly | object | Override an operation's next response only, then fall back | - | src/testing/piefed/index.ts:260 |
once.createComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:63 |
once.createPost | public | (responder) => void | - | - | src/testing/piefed/index.ts:71 |
once.createPrivateMessage | public | (responder) => void | - | - | src/testing/piefed/index.ts:80 |
once.deleteComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:84 |
once.deletePost | public | (responder) => void | - | - | src/testing/piefed/index.ts:88 |
once.editComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:92 |
once.editPost | public | (responder) => void | - | - | src/testing/piefed/index.ts:100 |
once.followCommunity | public | (responder) => void | - | - | src/testing/piefed/index.ts:109 |
once.getComments | public | (responder) => void | - | - | src/testing/piefed/index.ts:113 |
once.getCommunity | public | (responder) => void | - | - | src/testing/piefed/index.ts:128 |
once.getPersonDetails | public | (responder) => void | - | - | src/testing/piefed/index.ts:134 |
once.getPost | public | (responder) => void | - | - | src/testing/piefed/index.ts:140 |
once.getPosts | public | (responder) => void | - | - | src/testing/piefed/index.ts:146 |
once.getSite | public | (responder) => void | - | - | src/testing/piefed/index.ts:161 |
once.getUnreadCount | public | (responder) => void | - | - | src/testing/piefed/index.ts:162 |
once.likeComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:163 |
once.likePost | public | (responder) => void | - | - | src/testing/piefed/index.ts:170 |
once.login | public | (responder) => void | - | - | src/testing/piefed/index.ts:177 |
once.markPostAsRead | public | (responder) => void | - | - | src/testing/piefed/index.ts:184 |
once.resolveObject | public | (responder) => void | - | - | src/testing/piefed/index.ts:188 |
once.saveComment | public | (responder) => void | - | - | src/testing/piefed/index.ts:194 |
once.savePost | public | (responder) => void | - | - | src/testing/piefed/index.ts:198 |
once.search | public | (responder) => void | - | - | src/testing/piefed/index.ts:199 |
seed | readonly | SeedStore | Semantic content store the default routes are derived from | - | src/testing/piefed/index.ts:263 |
waitForPayload | readonly | <Operation>(operation, predicate?, options?) => Promise<PayloadOf<object[Operation]>> | Wait for an operation's next request; resolves its canonical payload | - | src/testing/piefed/index.ts:266 |
Methods
calls()
calls(matcher): RecordedCall[];Defined in: src/testing/FakeInstance.ts:189
All recorded requests matching "METHOD /path" (query ignored).
Parameters
| Parameter | Type |
|---|---|
matcher | | `POST /${string}` | `DELETE /${string}` | `GET /${string}` | `PUT /${string}` |
Returns
Inherited from
clientOptions()
clientOptions(): ThreadiverseClientOptions;Defined in: src/testing/FakeInstance.ts:205
Options for a ThreadiverseClient scoped to this fake: routes fetch through the instance and isolates software discovery from the process-global cache (so multiple fakes for the same host — e.g. different versions across tests — can't contaminate each other).
const client = new ThreadiverseClient(fake.origin, fake.clientOptions());Returns
Inherited from
handle()
handle(request): Promise<FakeResponse | undefined>;Defined in: src/testing/FakeInstance.ts:252
Resolve a request against the route table.
Returns undefined for requests to other origins (callers decide whether to pass those through). Unmocked same-origin requests are answered with a loud 404 instead of escaping to the real network.
Parameters
| Parameter | Type |
|---|---|
request | FakeRequest |
Returns
Promise<FakeResponse | undefined>
Inherited from
install()
install(page): Promise<void>;Defined in: src/testing/FakeInstance.ts:290
Install onto a Playwright page. Routes all traffic for this instance's origin; other origins are untouched.
Parameters
| Parameter | Type |
|---|---|
page | PageLike |
Returns
Promise<void>
Inherited from
mock()
mock(matcher, responder): void;Defined in: src/testing/FakeInstance.ts:317
Set (or replace) the response for an endpoint. Last call wins.
Parameters
| Parameter | Type |
|---|---|
matcher | | `POST /${string}` | `DELETE /${string}` | `GET /${string}` | `PUT /${string}` |
responder | Responder |
Returns
void
Inherited from
mockOnce()
mockOnce(matcher, responder): void;Defined in: src/testing/FakeInstance.ts:322
Respond once for an endpoint, then fall back to the standing mock.
Parameters
| Parameter | Type |
|---|---|
matcher | | `POST /${string}` | `DELETE /${string}` | `GET /${string}` | `PUT /${string}` |
responder | Responder |
Returns
void
Inherited from
waitForCall()
waitForCall(
matcher,
predicate?,
__namedParameters?): Promise<RecordedCall>;Defined in: src/testing/FakeInstance.ts:333
Wait until a matching request is recorded, then return the latest. Resolution is push-based (no polling), so pending waiters settle the moment the request lands — only the timeout path needs real timers.
Parameters
| Parameter | Type |
|---|---|
matcher | | `POST /${string}` | `DELETE /${string}` | `GET /${string}` | `PUT /${string}` |
predicate | (call) => boolean |
__namedParameters | { timeoutMs?: number; } |
__namedParameters.timeoutMs? | number |
Returns
Promise<RecordedCall>
Inherited from
buildOperationApi()
protected buildOperationApi<Ops>(operations, renderError): OperationApi<Ops>;Defined in: src/testing/FakeInstance.ts:368
Build the operation-level API (on/once/callsTo/waitForPayload) from a provider's operation definitions plus its error wire renderer.
Type Parameters
| Type Parameter |
|---|
Ops extends Record<string, OperationDef<unknown>> |
Parameters
| Parameter | Type |
|---|---|
operations | Ops |
renderError | (error) => FakeResponse |
Returns
OperationApi<Ops>
