Skip to content

Commit 9f5b2d3

Browse files
committed
add docs and tests
1 parent 5d0a935 commit 9f5b2d3

File tree

4 files changed

+785
-0
lines changed

4 files changed

+785
-0
lines changed

DOCS/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,43 @@ npm run tauri build
5959
In the desktop app, click "Pull from Server", enter your remote URL (e.g.,
6060
https://your-rsss.workers.dev), and it will sync all feeds and items to your
6161
local SQLite database.
62+
63+
64+
--------------------------------
65+
66+
67+
## Tests
68+
69+
Test Files
70+
71+
### test/sync.ts (47 tests)
72+
73+
Tests for the sync workflow:
74+
75+
* Sync endpoint logic: Full sync, incremental sync with since parameter,
76+
boundary conditions
77+
* Response structure: Validates feeds, items, timestamps
78+
* Client-side upsert logic: Insert, update, preserve unchanged records
79+
* Sync state management: Initial state, shouldFullSync behavior, state
80+
preservation
81+
82+
### test/db-adapter.ts (33 tests)
83+
84+
Tests for the database adapter interface contract.
85+
86+
* Feed operations: addFeed, getFeeds (sorted), deleteFeed (cascade)
87+
* Item operations: getItems with pagination, filtering by
88+
feedId/isRead/isStarred
89+
* Update operations: updateItem (read/starred), markAllRead (all or by feed)
90+
* Counts: getCounts accuracy, empty database edge case
91+
92+
93+
### Running Tests
94+
95+
```sh
96+
npm test
97+
```
98+
99+
The tests use `@substrate-system/tapzero` and run in a browser environment via
100+
`tapout`. They test the sync logic by simulating the endpoint behavior and
101+
adapter interface.

0 commit comments

Comments
 (0)