-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Cuong Vu
authored
Sep 10, 2020
1 parent
026dbd6
commit 4889a00
Showing
5 changed files
with
205 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ import { | |
openDisableMemberModal, | ||
openReinviteModal, | ||
closeReinviteModal, | ||
handleGenerateUniqueDataList, | ||
} from '../members' | ||
import { developerStub } from '@/sagas/__stubs__/developer' | ||
import * as ReactRedux from 'react-redux' | ||
|
@@ -65,3 +66,145 @@ describe('Members', () => { | |
}) | ||
}) | ||
}) | ||
|
||
describe('handleGenerateUniqueDataList', () => { | ||
it('should run correctly with pending', () => { | ||
const data = [ | ||
{ | ||
id: '879551ef-1127-4088-a0cb-40a7a0df188b', | ||
created: '2020-09-09T10:26:10', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engineer', | ||
status: 'pending', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
{ | ||
id: 'd42b6362-dbf2-4250-93e1-1e63ee2ebcda', | ||
created: '2020-09-09T10:26:36', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engin', | ||
status: 'pending', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
] | ||
const fn = handleGenerateUniqueDataList(data) | ||
const result = fn() | ||
const expected = [ | ||
{ | ||
id: 'd42b6362-dbf2-4250-93e1-1e63ee2ebcda', | ||
created: '2020-09-09T10:26:36', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engin', | ||
status: 'pending', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
] | ||
expect(result).toEqual(expected) | ||
}) | ||
|
||
it('should run correctly with active & pending', () => { | ||
const data = [ | ||
{ | ||
id: '879551ef-1127-4088-a0cb-40a7a0df188b', | ||
created: '2020-09-09T10:26:10', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engineer', | ||
status: 'pending', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
{ | ||
id: 'd42b6362-dbf2-4250-93e1-1e63ee2ebcda', | ||
created: '2020-09-09T10:26:36', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engin', | ||
status: 'active', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
] | ||
const fn = handleGenerateUniqueDataList(data) | ||
const result = fn() | ||
const expected = [ | ||
{ | ||
id: 'd42b6362-dbf2-4250-93e1-1e63ee2ebcda', | ||
created: '2020-09-09T10:26:36', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engin', | ||
status: 'active', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
] | ||
expect(result).toEqual(expected) | ||
}) | ||
|
||
it('should run correctly with active & pending & inactive', () => { | ||
const data = [ | ||
{ | ||
id: '879551ef-1127-4088-a0cb-40a7a0df188b', | ||
created: '2020-09-09T10:26:10', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engineer', | ||
status: 'pending', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
{ | ||
id: 'd42b6362-dbf2-4250-93e1-1e63ee2ebcda', | ||
created: '2020-09-09T10:26:36', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engin', | ||
status: 'active', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
{ | ||
id: 'd42b6362-dbf2-4250-93e1-1e63ee2ebcda', | ||
created: '2020-09-09T10:24:36', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engin', | ||
status: 'inactive', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
] | ||
const fn = handleGenerateUniqueDataList(data) | ||
const result = fn() | ||
const expected = [ | ||
{ | ||
id: 'd42b6362-dbf2-4250-93e1-1e63ee2ebcda', | ||
created: '2020-09-09T10:26:36', | ||
email: '[email protected]', | ||
name: 'cuong', | ||
jobTitle: 'Engin', | ||
status: 'active', | ||
role: 'user', | ||
developerId: '909dcdc1-6657-4a37-a5cc-05acd79d6a47', | ||
agencyCloudAccess: false, | ||
}, | ||
] | ||
expect(result).toEqual(expected) | ||
}) | ||
}) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.