Changeset 1485933 in Klonkt for test/feed-pagination.test.js
- Timestamp:
- 07/20/2026 07:35:55 AM (7 weeks ago)
- Branches:
- main
- Children:
- 520e477
- Parents:
- 7b04d3b
- git-author:
- Robin <roboburr@…> (07/20/2026 07:18:02 AM)
- git-committer:
- Robin <roboburr@…> (07/20/2026 07:35:55 AM)
- File:
-
- 1 edited
-
test/feed-pagination.test.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
test/feed-pagination.test.js
r7b04d3b r1485933 41 41 assert.equal(AP.getTimeline('me', 72, 300).length, 0); 42 42 }); 43 44 // getMessages pages the merged stream by offset (recompute-top-down + slice). 45 const fins = db.prepare('INSERT OR IGNORE INTO ap_followers (slug, actor_uri, created_at) VALUES (?,?,?)'); 46 for (let i = 0; i < 150; i++) { 47 const n = String(i).padStart(3, '0'); 48 const hh = String(23 - Math.floor(i / 60)).padStart(2, '0'); 49 const mm = String(59 - (i % 60)).padStart(2, '0'); 50 fins.run('me', 'https://r.test/u/f' + n, `2026-02-01 ${hh}:${mm}:00`); 51 } 52 53 test('getMessages pages the stream by offset without overlap', () => { 54 const p1 = AP.getMessages('me', 72, 0); 55 const p2 = AP.getMessages('me', 72, 72); 56 assert.equal(p1.length, 72); 57 assert.equal(p2.length, 72); 58 const k = (m) => m.type + '|' + (m.url || m.handle || m.outboxId || ''); 59 const set1 = new Set(p1.map(k)); 60 assert.equal(p2.filter((m) => set1.has(k(m))).length, 0, 'no overlap between pages'); 61 }); 62 63 test('getMessages probe of PAGE+1 signals the last page', () => { 64 assert.equal(AP.getMessages('me', 73, 0).length, 73); // more remain 65 assert.equal(AP.getMessages('me', 73, 144).length, 6); // 150 follows → 6 left 66 });
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)