All Questions
8 questions
0
votes
1
answer
618
views
Async redux actions tests always return pending
I am writing tests for some async actions however the tests are failing because the type which is returned is always REQUEST_PENDING. So even for the tests when the data is fetched the type does not ...
1
vote
0
answers
1k
views
How to use Jest to test async Redux Action Creators with Axios (async/await) and Redux Thunk?
TL;DR: how to use Jest to test an asynchronous Redux action creator that fetch data from an API using Axios when the async action creator do not returns a promise but use async/await?
export const ...
1
vote
1
answer
4k
views
TypeError: (0 , _ApiCalls.default) is not a function jest tesing the axios call
I'm pretty new to Jest and I completed testing all the components of my project and now when I wanted to test the axios call I'm facing this erro.
My test
import addPatients from '../ApiCalls/...
0
votes
1
answer
1k
views
Async Action Creator - Jest and Axios - Timeout - Async callback was not invoked
I am writing tests for my async action creators but I am getting a timeout error when my test runs. I tried
Moxios
Increasing jest timeout
MockAdapter
I am currently trying Moxios again.
myTest (...
0
votes
1
answer
978
views
Check if dispatch action is called in axios interceptor using Jest
I want to test if the loginReset() function is being called every time there's an unauthorized request or response status code 401.
My code is what follows:
use-request.js
import axios from "axios"
...
0
votes
1
answer
35
views
How to write unit test case for async method in react?
I am trying to write a unit test case for an async function which having for loop inside and in each iteration it calls Axios "get" method.
I am new to unit test cases, and I know how to write it for ...
0
votes
1
answer
2k
views
How to test post calls in axios with jest and axios-mock-adapter
i have this action that i have to test
export function addContractorToJob(values) {
return dispatch => {
axios.post(`${API_URL}add-contractor`, values)
.then((job) => {
...
171
votes
7
answers
340k
views
How do I test axios in Jest?
I have this action in React:
export function fetchPosts() {
const request = axios.get(`${WORDPRESS_URL}`);
return {
type: FETCH_POSTS,
payload: request
}
}
How do I test ...