All Questions
27 questions
0
votes
0
answers
264
views
Jest custom render importing react-redux provider error
I'm trying to make some testing for a react-native project but jest is encountering this error and I don't know why:
FAIL __tests__/(tabs)/weather.test.tsx
● Test suite failed to run
Jest ...
5
votes
1
answer
4k
views
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNLocalize' could not be found, react native when importing redux state from jest testing
React native: Changing variable in redux state from test files in jest, after application build.
Since I cannot write the whole logic, components and props in the test file, I need to pass just one ...
1
vote
0
answers
234
views
How to write test case for react native redux and persist using just
I am writing test case for react native functional component application I am facing issue for redux and persist mocking
mock the redux and persist data in react native application
import React ...
0
votes
2
answers
356
views
How can I test if a curried axios action was called?
I have a following action, it's an axios call with curried dispatch.
Note: originally, we wouldn't need to curry the action call like that, but let's say there is a situation where I need to make it ...
0
votes
1
answer
2k
views
How to write the test for useSelector with Jest
I'm new to testing and very confused on what I need to do to thoroughly test my MealsSummary.tsx component. I want to start with testing if my component is retrieving items from the redux store ...
0
votes
1
answer
165
views
How to rewrite test with jest?
Hi I had simple snapshot test but I needed to save data from API with redux toolkit and after that it's always failing.
DashboardScreen.tsx
const DashboardScreen = () => {
// added block of code
...
1
vote
1
answer
495
views
How to snapshot test with jest and RTKquery?
I'm bothering with it couple days. My goal is to snapshot screen/component but I'm stuck.
I have to use jest snapshot and the library react redux toolkit query.
In the ContactScreen are rendered data ...
11
votes
2
answers
19k
views
Invalid hook call while testing with jest - react native
I've got problem with testing screen. I'm trying to test with jest snapshot but first of all I wan't to pass simple test with RTK Query request API. In next example I try to get error something like ...
1
vote
0
answers
3k
views
Unable to find an element by: [data-testid=“movieList”]
I need to test results in my ul from the movielistcomponent but i keep getting unbale to find element [data-testid=movieList]
My movielistComponent
</section>
{isLoaded ? (
...
0
votes
1
answer
108
views
How to test connected component using jest?
This is my component in react native and all the functionality in the component is working fine.
import React from 'react';
import { View, Text } from 'react-native';
import { connect } from 'react-...
2
votes
0
answers
1k
views
Fetch-Mock Error. No fallback response defined for POST
I need to test an asynchronous function (redux thunk) in jest. To do this, I decided to use fetchMock. But I'm having problems. The test ends successfully but I get an error from fetch
'fetch-mock: ...
0
votes
1
answer
1k
views
Issue mocking a Redux Store with Jest/redux-mock-store
I've been trying to mock a redux store which is inside a dependency module with no success as below:
//configStore.js
const store = createStore(
combineReducers(reducers),
undefined,
...
0
votes
0
answers
72
views
How to test a store update triggered by action creator in ComponentDidMount
I am trying to test a connected component that fetches an image from the bing API to set as background image on ComponentDidMount. The test is quite simple, I am using Enzyme to render the component ...
1
vote
0
answers
81
views
RN+Redux+Jest - Cannot test async function because file imports Store
I am developing an app that has two functions called fetchAnonymous and fetchAuthenticated that checks if the user is logged in or not. If it is not logged in, dispatches an action to logout the user ...
1
vote
0
answers
659
views
Jest with Enzyme - Snapshot of connected component looks different to my code
Is this a valid enzyme snapshot? It doesn't look much like my code to define the component. I don't think dive() is achieving the expected result? What am i doing wrong?:
// Jest Snapshot v1
exports[...