New Group administration: Add users
This commit is contained in:
parent
e81c18e84c
commit
b81a52bbdd
43 changed files with 1789 additions and 277 deletions
41
ts/test-both/util/filterAndSortContacts_test.ts
Normal file
41
ts/test-both/util/filterAndSortContacts_test.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { getDefaultConversation } from '../helpers/getDefaultConversation';
|
||||
|
||||
import { filterAndSortContacts } from '../../util/filterAndSortContacts';
|
||||
|
||||
describe('filterAndSortContacts', () => {
|
||||
const conversations = [
|
||||
getDefaultConversation({
|
||||
title: '+16505551234',
|
||||
firstName: undefined,
|
||||
profileName: undefined,
|
||||
}),
|
||||
getDefaultConversation({ title: 'Carlos Santana' }),
|
||||
getDefaultConversation({ title: 'Aaron Aardvark' }),
|
||||
getDefaultConversation({ title: 'Belinda Beetle' }),
|
||||
getDefaultConversation({ title: 'Belinda Zephyr' }),
|
||||
];
|
||||
|
||||
it('without a search term, sorts conversations by title', () => {
|
||||
const titles = filterAndSortContacts(conversations, '').map(
|
||||
contact => contact.title
|
||||
);
|
||||
assert.deepEqual(titles, [
|
||||
'+16505551234',
|
||||
'Aaron Aardvark',
|
||||
'Belinda Beetle',
|
||||
'Belinda Zephyr',
|
||||
'Carlos Santana',
|
||||
]);
|
||||
});
|
||||
|
||||
it('filters conversations a search terms', () => {
|
||||
const titles = filterAndSortContacts(conversations, 'belind').map(
|
||||
contact => contact.title
|
||||
);
|
||||
assert.deepEqual(titles, ['Belinda Beetle', 'Belinda Zephyr']);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue