diff options
| author | Adam Soltys <[email protected]> | 2026-09-24 08:16:17 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-24 08:16:17 -0700 |
| commit | cdca3fa061c856f9063aadfabf1c1e713f512123 (patch) | |
| tree | 79f398e0d9570d7fc9f9947ce8e7de3e4e5024f8 /tools/thread-cache-test.js | |
| parent | 7fae8198ef36396e4c65e66597d8e6e6f74ab1d1 (diff) | |
| download | coinosv3-cdca3fa061c856f9063aadfabf1c1e713f512123.tar.gz coinosv3-cdca3fa061c856f9063aadfabf1c1e713f512123.zip | |
Paint cached thread counts and header hat on refresh
Diffstat (limited to 'tools/thread-cache-test.js')
| -rw-r--r-- | tools/thread-cache-test.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/thread-cache-test.js b/tools/thread-cache-test.js index 14e5da6..485e874 100644 --- a/tools/thread-cache-test.js +++ b/tools/thread-cache-test.js @@ -19,7 +19,7 @@ check('a fresh store restores full content and tags by any viewed event', () => const long = { ...reply, content: 'x'.repeat(5000), tags: [...reply.tags, ['emoji', 'wave', 'https://example.com/wave.png']] }; store.save({ root, replies: [parent, long] }, long.id); const restored = createThreadStore(storage).find(long.id); - assert.deepEqual(restored, { rootId: root.id, root, profiles: {}, replies: [long, parent] }); + assert.deepEqual(restored, { rootId: root.id, root, profiles: {}, counts: {}, replies: [long, parent] }); assert.equal(store.find(parent.id).root.id, root.id); }); check('thread authors keep their names and local avatar thumbnails across reloads', () => { @@ -31,6 +31,11 @@ check('thread authors keep their names and local avatar thumbnails across reload assert.deepEqual(createThreadStore(storage).find(reply.id).profiles[root.pubkey], { ...face, t: 0 }); }); +check('thread action totals are present before relay refresh and survive a context save', () => { + store.save({ root, replies: [parent, reply] }, reply.id, {}, { [reply.id]: { likes: 29, boosts: 7, sats: 210 } }); + store.save({ root, replies: [parent, reply] }, reply.id); + assert.deepEqual(createThreadStore(storage).find(reply.id).counts[reply.id], { likes: 29, boosts: 7, sats: 210 }); +}); check('a large thread retains the selected reply and its ancestors', () => { const siblings = Array.from({ length: 200 }, (_, i) => note(1000 + i, [['e', root.id, '', 'root']])); store.save({ root, replies: [...siblings, parent, reply] }, reply.id); |
