Skip to content

Commit 176dbd8

Browse files
authored
Merge pull request Expensify#68768 from Expensify/andrew-perf-tests
[NO QA] Add an enhanced mock for ReportUtils to fix tests
2 parents 8b4cc1a + 8558ca3 commit 176dbd8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/perf-test/OptimisticReportNames.perf-test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
1313

1414
// Mock dependencies
1515
jest.mock('@libs/ReportUtils', () => ({
16+
// jest.requireActual is necessary to include multi-layered module imports (eg. Report.ts has processReportIDDeeplink() which uses parseReportRouteParams() imported from getReportIDFromUrl.ts)
17+
// Without jest.requireActual, parseReportRouteParams would be undefined, causing the test to fail.
1618
...jest.requireActual<typeof ReportUtils>('@libs/ReportUtils'),
19+
// These methods are mocked below in the beforeAll function to return specific values
1720
isExpenseReport: jest.fn(),
1821
getTitleReportField: jest.fn(),
1922
}));

0 commit comments

Comments
 (0)