hey all I have working tests and I know it wants me to wrap my render in an act but if I do that I get a warning stating it can't find root. yet if I then instead change it to create i can't use my getbyTestId method.
`it('should not render image', async () => { // Arrange // needs to be used to support async mounting methods like useeffect/componentdidmount jest.useFakeTimers(); const testComment = { text: 'placeholder' } as WorkItemComment; await act(async () => { AsyncStorage.setItem('authMethod', 'msa') }); const placeholderComment: WorkItemComment = testComment; const placeholderImage: string = 'image'; // Act const { queryByTestId } = render(<CommentList workItemComments={[placeholderComment]} profilePicture={[placeholderImage]} />); // Assert await wait(() => { expect(queryByTestId('image')).toBeNull(); }) });`
actual component its rendering and where believe this error is stemming from.
`const fetch = async () => { const authMethod = await AsyncStorage.getItem('authMethod'); setAuthMethod(authMethod!) }; useEffect(() => { fetch(); }, [props.workItemComments]);`
my actual error message is as followsconsole.error node_modules/react-native/Libraries/LogBox/LogBox.js:33Warning: An update to CommentList inside a test was not wrapped in act(...).
When testing, code that causes React state updates should be wrapped into act(...):act(() => { /* fire events that update state */});/* assert on the output */This ensures that you're testing the behavior the user would see in the browser in CommentList in View (created by View) in View (created by AppContainer) in View (created by View) in View (created by AppContainer) in AppContainer (at src/index.js:26)