Redux Challenge Tests Not Passing

The challenge (named below) is not passing the tests with the code that I have, and it should be passing the tests from what I understand.

Redux: Use Middleware to Handle Asynchronous Actions

Dispatching handleAsync should dispatch the data request action and then dispatch the received data action after a delay.

Code being used:


const requestingData = () => { return {type: REQUESTING_DATA} }
const receivedData = (data) => { return {type: RECEIVED_DATA, users: data.users} }

const handleAsync = () => {
  return function(dispatch) {

    setTimeout(function() {
      let data = {
        users: ['Jeff', 'William', 'Alice']

    }, 2500);

const defaultState = {
  fetching: false,
  users: []

const asyncDataReducer = (state = defaultState, action) => {
  switch(action.type) {
      return {
        fetching: true,
        users: []
      return {
        fetching: false,
        users: action.users
      return state;

const store = Redux.createStore(


Pretty close!

Instead of passing only the definition of requestingData here, make sure you are calling it by requestingData()

1 Like

I changed dispatch(requestingData) to dispatch(requestingData()) which now passes the aforementioned test, but now the following test fails to pass (and I checked that it does in fact reach the REQUESTING_DATA action inside of the reducer), so that doesn’t make sense as to why it would not pass the test.

Dispatching the requestingData action creator should update the store state property of fetching to true .

Can you post your updated code?

Instead of posting it here, check the OP as I’ve updated it there. However, the only change I did make was to invoke the function requestingData rather than pass the method like I was doing.

You don’t need this line here. You don’t have to explicitly dispatch handleAsync for the purpose this exercise.

1 Like

Ah, that solved it. I initially added that because of my problem where I was passing the definition of requestingData (and receivedData prior to testing), as I was unable to see the results in the switch statement.