Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
bosiraphael committed Mar 22, 2024
1 parent 3d8dffb commit 646cee8
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Contacts } from 'src/modules/connected-account/auto-companies-and-contacts-creation/types/contact.type';
import { getUniqueContactsAndHandles } from 'src/modules/connected-account/auto-companies-and-contacts-creation/utils/get-unique-contacts-and-handles.util';

describe('getUniqueContactsAndHandles', () => {
it('should return empty arrays when contacts is empty', () => {
const contacts: Contacts = [];
const result = getUniqueContactsAndHandles(contacts);

expect(result.uniqueContacts).toEqual([]);
expect(result.uniqueHandles).toEqual([]);
});

it('should return unique contacts and handles', () => {
const contacts: Contacts = [
{ handle: '[email protected]', displayName: 'John Doe' },
{ handle: '[email protected]', displayName: 'John Doe' },
{ handle: '[email protected]', displayName: 'Jane Smith' },
{ handle: '[email protected]', displayName: 'Jane Smith' },
{ handle: '[email protected]', displayName: 'Jane Smith' },
];
const result = getUniqueContactsAndHandles(contacts);

expect(result.uniqueContacts).toEqual([
{ handle: '[email protected]', displayName: 'John Doe' },
{ handle: '[email protected]', displayName: 'Jane Smith' },
]);
expect(result.uniqueHandles).toEqual([
'[email protected]',
'[email protected]',
]);
});
});

0 comments on commit 646cee8

Please sign in to comment.