-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d8dffb
commit 646cee8
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...o-companies-and-contacts-creation/utils/__tests__/get-unique-contacts-and-handles.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]', | ||
]); | ||
}); | ||
}); |