-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38271 from ShridharGoel/patch-1
[NoQA] Add performance tests for getMemberAccountIDsForWorkspace
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {measureFunction} from 'reassure'; | ||
import {getMemberAccountIDsForWorkspace} from '@libs/PolicyUtils'; | ||
import type {PersonalDetails, PolicyMember} from '@src/types/onyx'; | ||
import createCollection from '../utils/collections/createCollection'; | ||
import createPersonalDetails from '../utils/collections/personalDetails'; | ||
import createRandomPolicyMember from '../utils/collections/policyMembers'; | ||
|
||
describe('PolicyUtils', () => { | ||
describe('getMemberAccountIDsForWorkspace', () => { | ||
test('500 policy members with personal details', async () => { | ||
const policyMembers = createCollection<PolicyMember>( | ||
(_, index) => index, | ||
() => createRandomPolicyMember(), | ||
); | ||
const personalDetails = createCollection<PersonalDetails>((_, index) => index, createPersonalDetails); | ||
|
||
await measureFunction(() => getMemberAccountIDsForWorkspace(policyMembers, personalDetails)); | ||
}); | ||
|
||
test('500 policy members with errors and personal details', async () => { | ||
const policyMembers = createCollection<PolicyMember>( | ||
(_, index) => index, | ||
() => ({ | ||
...createRandomPolicyMember(), | ||
errors: {error: 'Error message'}, | ||
}), | ||
); | ||
const personalDetails = createCollection<PersonalDetails>((_, index) => index, createPersonalDetails); | ||
|
||
await measureFunction(() => getMemberAccountIDsForWorkspace(policyMembers, personalDetails)); | ||
}); | ||
}); | ||
}); |
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,9 @@ | ||
import {randWord} from '@ngneat/falso'; | ||
import type {PolicyMember} from '@src/types/onyx'; | ||
|
||
export default function createRandomPolicyMember(): PolicyMember { | ||
return { | ||
role: randWord(), | ||
errors: {}, | ||
}; | ||
} |