fix p2p conversation avatars
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { friendAvatarLookup } from '../src/features/messages/chat-list.ts';
|
||||
|
||||
test('friend avatars resolve by both user ID and established P2P topic', () => {
|
||||
const avatars = friendAvatarLookup([
|
||||
{
|
||||
user_id: 'usr-potter',
|
||||
topic: 'p2p-potter',
|
||||
avatar_file_id: 'https://example.com/potter.png',
|
||||
},
|
||||
]);
|
||||
|
||||
assert.equal(avatars.get('usr-potter'), 'https://example.com/potter.png');
|
||||
assert.equal(avatars.get('p2p-potter'), 'https://example.com/potter.png');
|
||||
});
|
||||
|
||||
test('friend avatar lookup tolerates a new conversation without a topic alias', () => {
|
||||
const avatars = friendAvatarLookup([{ user_id: 'usr-new', avatar_file_id: 'avatar-file-id' }]);
|
||||
|
||||
assert.equal(avatars.get('usr-new'), 'avatar-file-id');
|
||||
assert.equal(avatars.has(''), false);
|
||||
});
|
||||
Reference in New Issue
Block a user