diff --git a/content/docs/(reference)/swift-sdk.mdx b/content/docs/(reference)/swift-sdk.mdx index 928b00ba..f49cc9b5 100644 --- a/content/docs/(reference)/swift-sdk.mdx +++ b/content/docs/(reference)/swift-sdk.mdx @@ -507,15 +507,16 @@ Its `FolderEvent` values are `.watching` when it starts and `.passed` after a pa ## Test against a fake copy -`WorkingCopy.fake(items:itemTypes:)` returns a `FakeCopy` whose `copy` is a real `WorkingCopy` over an engine that keeps items, edges and types in memory. Its argument checks, change feed and value conversion are the ones your app ships. +`WorkingCopy.fake(items:edges:itemTypes:edgeTypes:views:)` returns a `FakeCopy` whose `copy` is a real `WorkingCopy` over an engine that keeps items, edges and types in memory. Its argument checks, change feed and value conversion are the ones your app ships. The fake answers these calls: - **Reads:** `items.list(_:sort:)` without a `filter`, including the `source`, updated and occurred ranges and a sort on a property; `items.get(_:)`; the edge reads; the `catalog` reads; `declaredTypes()`; and `status()`. - **Writes:** `items.create(_:)` without a `sourceId`, including `state`, a capture location and `edges`; `items.update(_:_:)`, including `occurredAt` and `clearOccurredAt`; the other item, edge, tag, metadata and extension writes; and `declareTypes(_:)`. +- **Views:** `createView(_:idempotencyKey:)`, `changeView(_:_:baseVersion:idempotencyKey:)`, `deleteView(_:idempotencyKey:)`, `items.views()`, `items.view(_:)`, `items.list(inView:limit:offset:)` and `items.groups(inView:timeZone:)`. Pass `views:` to hold saved views from the start. A view write is never queued and announces the same changes as a real copy, and a change based on an older version merges or throws `version_conflict` as the instance does. A view lists the items its `query` names (`types` with their subtypes, `tier`, `state`, `beneath`), in its `sort`, and groups them as the core does. The fake can't judge a `filter` in a view's query: it stores one, and a list or a grouping of that view throws `unsupported`. - **The queue and changes:** `queue.all()`, `queue.drain()`, `queue.withdraw(_:)`, `queue.discard(_:)`, `queue.forgetAnswered()` and `changes()`. -**A call, or an input to a call, that the fake can't match exactly throws `FakeCopyError.unsupported(call:)`** instead of answering differently. That covers a `filter`, `search`, hydration, files, views and folders, a capture coordinate that is out of range or has no partner, and an `occurredAt` in a form the fake doesn't check. The fake knows only the types you give it and the ones your app declares, not Marfa's built-in catalog, and it doesn't check an edge type's constraints. Because the fake has no instance, a create never lands on an item the instance already holds. +**A call, or an input to a call, that the fake can't match exactly throws `FakeCopyError.unsupported(call:)`** instead of answering differently. That covers a `filter`, `search` (including `search(_:inView:)`), hydration, files and folders, a capture coordinate that is out of range or has no partner, and an `occurredAt` in a form the fake doesn't check. The fake knows only the types you give it and the ones your app declares, not Marfa's built-in catalog, and it doesn't check an edge type's constraints. Because the fake has no instance, a create never lands on an item the instance already holds. ## Handle errors