diff options
| author | Adam Soltys <[email protected]> | 2026-09-24 07:35:56 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-24 07:35:56 -0700 |
| commit | 7fae8198ef36396e4c65e66597d8e6e6f74ab1d1 (patch) | |
| tree | c651eccbde76ec2bea34793993da71e0850ea3a8 /tools/thread-cache-test.js | |
| parent | f6fd9f998831330e3a8819e294cdd8d15c1a87f6 (diff) | |
| download | coinosv3-7fae8198ef36396e4c65e66597d8e6e6f74ab1d1.tar.gz coinosv3-7fae8198ef36396e4c65e66597d8e6e6f74ab1d1.zip | |
Keep thread avatars and viewport stable on refresh
Diffstat (limited to 'tools/thread-cache-test.js')
| -rw-r--r-- | tools/thread-cache-test.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/thread-cache-test.js b/tools/thread-cache-test.js index fd3f5c8..14e5da6 100644 --- a/tools/thread-cache-test.js +++ b/tools/thread-cache-test.js @@ -19,9 +19,18 @@ 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, replies: [long, parent] }); + assert.deepEqual(restored, { rootId: root.id, root, profiles: {}, 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', () => { + const thumb = 'data:image/webp;base64,AAAA'; + const face = { name: 'Nostrich', picture: 'https://example.com/face.webp', eventAt: 50, + thumbFor: 'https://example.com/face.webp', thumb, thumbPx: 144 }; + store.save({ root, replies: [parent, reply] }, reply.id, { [root.pubkey]: face }); + store.save({ root, replies: [parent, reply] }, reply.id); // a relay refresh must keep the face + assert.deepEqual(createThreadStore(storage).find(reply.id).profiles[root.pubkey], + { ...face, t: 0 }); +}); 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); |
