Don't mutate state in TimelineItem
This commit is contained in:
parent
1cc7c5dc2d
commit
80c1ad6ee3
5 changed files with 127 additions and 61 deletions
|
@ -1737,6 +1737,7 @@ describe('both/state/selectors/conversations', () => {
|
|||
|
||||
it('returns the right color order sorted by UUID ASC', () => {
|
||||
const group = makeConversation('group');
|
||||
group.type = 'group';
|
||||
group.sortedGroupMembers = [
|
||||
makeConversationWithUuid('zyx'),
|
||||
makeConversationWithUuid('vut'),
|
||||
|
@ -1766,5 +1767,28 @@ describe('both/state/selectors/conversations', () => {
|
|||
assert.equal(contactNameColorSelector('group', 'vut'), '330');
|
||||
assert.equal(contactNameColorSelector('group', 'zyx'), '230');
|
||||
});
|
||||
|
||||
it('returns the right colors for direct conversation', () => {
|
||||
const direct = makeConversation('theirId');
|
||||
const emptyState = getEmptyRootState();
|
||||
const state = {
|
||||
...emptyState,
|
||||
user: {
|
||||
...emptyState.user,
|
||||
ourConversationId: 'us',
|
||||
},
|
||||
conversations: {
|
||||
...getEmptyState(),
|
||||
conversationLookup: {
|
||||
direct,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const contactNameColorSelector = getContactNameColorSelector(state);
|
||||
|
||||
assert.equal(contactNameColorSelector('direct', 'theirId'), '200');
|
||||
assert.equal(contactNameColorSelector('direct', 'us'), '200');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue