From e3092294dfdaac54574f07f7655e39dc4e3536ca Mon Sep 17 00:00:00 2001 From: Francois Laithier Date: Wed, 14 Oct 2026 15:56:38 -0700 Subject: [PATCH] test(search): return Onyx metadata from SearchColumnsPage useOnyx mock usePolicyForMovingExpenses now reads the load status that useOnyx returns for the policy collection, and passes it to isLoadingOnyxValue. The SearchColumnsPage test mocked useOnyx to return only the value, so the metadata was undefined and the test crashed on main with "Cannot read properties of undefined (reading 'status')". Return a loaded status from the mock, as the real hook does. --- tests/ui/SearchColumnsPageTest.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui/SearchColumnsPageTest.tsx b/tests/ui/SearchColumnsPageTest.tsx index 5c8b96f9eaea..d0719828f7a2 100644 --- a/tests/ui/SearchColumnsPageTest.tsx +++ b/tests/ui/SearchColumnsPageTest.tsx @@ -38,7 +38,7 @@ describe('SearchColumnsPage', () => { } const form = buildFilterFormValuesFromQuery(queryJSON, {}, {}, {}, {}, {}, {}); - (jest.mocked(useOnyx) as jest.Mock).mockImplementation((key: string) => [key === ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM ? form : undefined]); + (jest.mocked(useOnyx) as jest.Mock).mockImplementation((key: string) => [key === ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM ? form : undefined, {status: 'loaded'}]); mockGetRootState.mockReturnValue({ routes: [{name: NAVIGATORS.TAB_NAVIGATOR, params: {screen: NAVIGATORS.SEARCH_FULLSCREEN_NAVIGATOR, params: {screen: SCREENS.SEARCH.ROOT, params: {q: input}}}}], });