Conversation details changes for PNP
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
1a74da0c26
commit
eb82ace2de
49 changed files with 1660 additions and 699 deletions
|
@ -29,7 +29,7 @@ import {
|
|||
getContactNameColorSelector,
|
||||
getConversationByIdSelector,
|
||||
getConversationServiceIdsStoppingSend,
|
||||
getConversationsByTitleSelector,
|
||||
getSafeConversationWithSameTitle,
|
||||
getConversationSelector,
|
||||
getConversationsStoppingSend,
|
||||
getFilteredCandidateContactsForNewGroup,
|
||||
|
@ -1577,32 +1577,32 @@ describe('both/state/selectors/conversations-extra', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('#getConversationsByTitleSelector', () => {
|
||||
describe('#getSafeConversationWithSameTitle', () => {
|
||||
it('returns a selector that finds conversations by title', () => {
|
||||
const unsafe = { ...makeConversation('abc'), title: 'Janet' };
|
||||
const safe = { ...makeConversation('def'), title: 'Janet' };
|
||||
const unique = { ...makeConversation('geh'), title: 'Rick' };
|
||||
const state = {
|
||||
...getEmptyRootState(),
|
||||
conversations: {
|
||||
...getEmptyState(),
|
||||
conversationLookup: {
|
||||
abc: { ...makeConversation('abc'), title: 'Janet' },
|
||||
def: { ...makeConversation('def'), title: 'Janet' },
|
||||
geh: { ...makeConversation('geh'), title: 'Rick' },
|
||||
abc: unsafe,
|
||||
def: safe,
|
||||
geh: unique,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const selector = getConversationsByTitleSelector(state);
|
||||
const janet = getSafeConversationWithSameTitle(state, {
|
||||
possiblyUnsafeConversation: unsafe,
|
||||
});
|
||||
assert.strictEqual(janet, safe);
|
||||
|
||||
assert.sameMembers(
|
||||
selector('Janet').map(c => c.id),
|
||||
['abc', 'def']
|
||||
);
|
||||
assert.sameMembers(
|
||||
selector('Rick').map(c => c.id),
|
||||
['geh']
|
||||
);
|
||||
assert.isEmpty(selector('abc'));
|
||||
assert.isEmpty(selector('xyz'));
|
||||
const rick = getSafeConversationWithSameTitle(state, {
|
||||
possiblyUnsafeConversation: unique,
|
||||
});
|
||||
assert.strictEqual(rick, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue