diff --git a/tests/perf-test/SidebarUtils.perf-test.ts b/tests/perf-test/SidebarUtils.perf-test.ts index b9d3cf5a379c..2d1dacf87657 100644 --- a/tests/perf-test/SidebarUtils.perf-test.ts +++ b/tests/perf-test/SidebarUtils.perf-test.ts @@ -3,14 +3,15 @@ import {measureFunction} from 'reassure'; import SidebarUtils from '@libs/SidebarUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import {PersonalDetails} from '@src/types/onyx'; import Policy from '@src/types/onyx/Policy'; import Report from '@src/types/onyx/Report'; import ReportAction from '@src/types/onyx/ReportAction'; import createCollection from '../utils/collections/createCollection'; +import createPersonalDetails from '../utils/collections/personalDetails'; import createRandomPolicy from '../utils/collections/policies'; import createRandomReportAction from '../utils/collections/reportActions'; import createRandomReport from '../utils/collections/reports'; -import * as LHNTestUtils from '../utils/LHNTestUtils'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; beforeAll(() => @@ -37,12 +38,16 @@ const reportActions = createCollection( (index) => createRandomReportAction(index), ); -const mockedResponseMap: Partial = getMockedReports(5000); +const personalDetails = createCollection( + (item) => item.accountID, + (index) => createPersonalDetails(index), +); + +const mockedResponseMap = getMockedReports(5000) as Record<`${typeof ONYXKEYS.COLLECTION.REPORT}`, Report>; const runs = CONST.PERFORMANCE_TESTS.RUNS; test('getOptionData on 5k reports', async () => { const report = createRandomReport(1); - const personalDetails = LHNTestUtils.fakePersonalDetails; const preferredLocale = 'en'; const policy = createRandomPolicy(1); const parentReportAction = createRandomReportAction(1); diff --git a/tests/utils/collections/createCollection.ts b/tests/utils/collections/createCollection.ts index 565957b7649e..848ef8f81f47 100644 --- a/tests/utils/collections/createCollection.ts +++ b/tests/utils/collections/createCollection.ts @@ -1,4 +1,4 @@ -export default function createCollection(createKey: (item: T, index: number) => string, createItem: (index: number) => T, length = 500): Record { +export default function createCollection(createKey: (item: T, index: number) => string | number, createItem: (index: number) => T, length = 500): Record { const map: Record = {}; for (let i = 0; i < length; i++) { diff --git a/tests/utils/collections/personalDetails.ts b/tests/utils/collections/personalDetails.ts new file mode 100644 index 000000000000..4fa8586aa08c --- /dev/null +++ b/tests/utils/collections/personalDetails.ts @@ -0,0 +1,12 @@ +import {randAvatar, randEmail, randWord} from '@ngneat/falso'; +import type {PersonalDetails} from '@src/types/onyx'; + +export default function createPersonalDetails(index: number): PersonalDetails { + return { + accountID: index, + avatar: randAvatar(), + displayName: randWord(), + lastName: randWord(), + login: randEmail(), + }; +}