Skip to content

Commit cf8f577

Browse files
committed
test: wrap IOURequestEditReportCommon test in NavigationContainer
`useAutoFocusInput` (newly used in IOURequestEditReportCommon) calls `useNavigation()` internally, which requires a NavigationContainer ancestor. Wrap the test render in one so the hook resolves.
1 parent d5f883d commit cf8f577

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

tests/ui/IOURequestEditReportCommonTest.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {NavigationContainer} from '@react-navigation/native';
12
import {act, render, screen} from '@testing-library/react-native';
23
import Onyx from 'react-native-onyx';
34
import ComposeProviders from '@components/ComposeProviders';
@@ -44,15 +45,17 @@ jest.mock('@components/OptionListContextProvider', () => ({
4445
*/
4546
const renderIOURequestEditReportCommon = ({selectedReportID = '', selectedPolicyID}: {selectedReportID: string; selectedPolicyID?: string}) =>
4647
render(
47-
<ComposeProviders components={[OnyxListItemProvider, LocaleContextProvider]}>
48-
<IOURequestEditReportCommon
49-
selectedReportID={selectedReportID}
50-
selectedPolicyID={selectedPolicyID}
51-
selectReport={jest.fn()}
52-
backTo=""
53-
isPerDiemRequest={false}
54-
/>
55-
</ComposeProviders>,
48+
<NavigationContainer>
49+
<ComposeProviders components={[OnyxListItemProvider, LocaleContextProvider]}>
50+
<IOURequestEditReportCommon
51+
selectedReportID={selectedReportID}
52+
selectedPolicyID={selectedPolicyID}
53+
selectReport={jest.fn()}
54+
backTo=""
55+
isPerDiemRequest={false}
56+
/>
57+
</ComposeProviders>
58+
</NavigationContainer>,
5659
);
5760

5861
describe('IOURequestEditReportCommon', () => {

0 commit comments

Comments
 (0)