In left pane and "add group member", sort E164-only contacts to the bottom
This commit is contained in:
parent
053c18f295
commit
45dbe4d145
2 changed files with 59 additions and 11 deletions
|
@ -10,32 +10,53 @@ describe('filterAndSortContacts', () => {
|
|||
const conversations = [
|
||||
getDefaultConversation({
|
||||
title: '+16505551234',
|
||||
firstName: undefined,
|
||||
e164: '+16505551234',
|
||||
name: undefined,
|
||||
profileName: undefined,
|
||||
}),
|
||||
getDefaultConversation({ title: 'Carlos Santana' }),
|
||||
getDefaultConversation({ title: 'Aaron Aardvark' }),
|
||||
getDefaultConversation({ title: 'Belinda Beetle' }),
|
||||
getDefaultConversation({ title: 'Belinda Zephyr' }),
|
||||
getDefaultConversation({
|
||||
name: 'Carlos Santana',
|
||||
title: 'Carlos Santana',
|
||||
e164: '+16505559876',
|
||||
}),
|
||||
getDefaultConversation({
|
||||
name: 'Aaron Aardvark',
|
||||
title: 'Aaron Aardvark',
|
||||
}),
|
||||
getDefaultConversation({
|
||||
name: 'Belinda Beetle',
|
||||
title: 'Belinda Beetle',
|
||||
}),
|
||||
getDefaultConversation({
|
||||
name: 'Belinda Zephyr',
|
||||
title: 'Belinda Zephyr',
|
||||
}),
|
||||
];
|
||||
|
||||
it('without a search term, sorts conversations by title', () => {
|
||||
it('without a search term, sorts conversations by title (but puts no-name contacts at the bottom)', () => {
|
||||
const titles = filterAndSortContacts(conversations, '').map(
|
||||
contact => contact.title
|
||||
);
|
||||
assert.deepEqual(titles, [
|
||||
'+16505551234',
|
||||
'Aaron Aardvark',
|
||||
'Belinda Beetle',
|
||||
'Belinda Zephyr',
|
||||
'Carlos Santana',
|
||||
'+16505551234',
|
||||
]);
|
||||
});
|
||||
|
||||
it('filters conversations a search terms', () => {
|
||||
it('can search for contacts by title', () => {
|
||||
const titles = filterAndSortContacts(conversations, 'belind').map(
|
||||
contact => contact.title
|
||||
);
|
||||
assert.deepEqual(titles, ['Belinda Beetle', 'Belinda Zephyr']);
|
||||
assert.sameMembers(titles, ['Belinda Beetle', 'Belinda Zephyr']);
|
||||
});
|
||||
|
||||
it('can search for contacts by phone number (and puts no-name contacts at the bottom)', () => {
|
||||
const titles = filterAndSortContacts(conversations, '650555').map(
|
||||
contact => contact.title
|
||||
);
|
||||
assert.sameMembers(titles, ['Carlos Santana', '+16505551234']);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue