react-native-testing-library Questions
2
Solved
Error I'm getting Anytime I run npm test:
FAIL ./App.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest ca...
Saiz asked 4/3, 2021 at 22:23
3
I'm new to unit testing and I'm trying to render a component to learn more about the library.
I'm trying to follow this guide.
Component
<TouchableOpacity
style={style}
onPress={onPress}
acce...
Material asked 7/3, 2021 at 12:8
1
Solved
I'm using ignite to create an expo react native app. I'm using this guide https://ignitecookbook.com/docs/recipes/GeneratorComponentTests to create component test files
Here is the first test file
...
Lyrate asked 14/7, 2023 at 1:59
2
Solved
Jest Redux Persist: TypeError: Cannot read property 'catch' of undefined at writeStagedState
I'm trying to test my LoginScreen with Jest and Typescript. I use redux and redux-persist for storage and have set the storage up to use AsyncStorage as part of the config. I suspect that redux-per...
Carolanncarole asked 18/5, 2020 at 18:40
8
I am using react-native-testing-library to test my react-native component.
I have a component (for the purpose of this post, it has been over simplified):
export const ComponentUnderTest = () =>...
Schizogony asked 1/12, 2019 at 23:57
1
How do I check that this TextInput component is focused? I know how to do it on the web:
const input = getByPlaceholderText("placeholder");
expect(document.activeElement).toEqual(input);
...
Ulna asked 11/1, 2021 at 12:11
5
In my new React Native app, I want to add some Jest tests.
One component renders a background image, which is located directly in the project in assets folder.
Now I stumbled about how to test if t...
Asis asked 3/3, 2020 at 14:34
2
How can I assert that a button is disabled in React Native Testing Library? I would imagine something like:
expect(getByRole('button')).toBeDisabled()
but RNTL doesn't provide toBeDisabled asserti...
Peccant asked 5/11, 2020 at 11:33
3
Solved
I'm trying to use jest-native as extra matchers and i'm having an installation problem i think
...
I am on a react-native ts app with expo and here are my versions:
expo:"~39.0.0"
@testi...
Sate asked 4/2, 2021 at 11:31
3
I use @testing-library/react-native to test my RN app. When I run yarn test, following error occurs.
@testing-library/react-native should have "jest-preset.js" or "jest-preset.json&q...
Spradling asked 15/11, 2020 at 19:13
1
Simply test case: Want to see if a given element is focused.
To check if an element is focused on a react web app with RTL and jest, you have two easy options available to you:
You can check if th...
Brownedoff asked 25/1, 2021 at 18:0
3
I'm having a bit of a hard time understanding how to test my modal component. I'm using the react-native-modals package and @testing-library/react-native with Jest. My component is a modal that pop...
Withrow asked 13/4, 2020 at 19:23
2
Below test is passing but I get the following warning twice and I don't know why. Could someone help me to figure it out?
console.error
Warning: You called act(async () => ...) without await. ...
Attach asked 22/11, 2020 at 9:17
2
I have a basic react-native/expo template app. I have added jest-expo and react-test-renderer in the dev dependencies, and also have updated package.json like documented in the expo docs for testin...
Hilariahilario asked 8/6, 2021 at 14:33
1
Solved
I have the following problem: I need to test if a function is being called on my test, but to test it properly I need to press enter or submit the form, and it doesn't seem to work as intended. I'v...
Landahl asked 4/1, 2021 at 14:26
1
Solved
I am really stuck on this in the project I am working on, and all the answers I have found seem to be so simple but they haven't worked for me. Perhaps I don't really understand what a mock is, and...
Yevette asked 18/6, 2020 at 17:1
1
© 2022 - 2024 — McMap. All rights reserved.