mercredi 18 novembre 2015

Test redux actions that calls an API

What is the best way to test this function

export function receivingItems() {
  return (dispatch, getState) => {
    axios.get('/api/items')
      .then(function(response) {
        dispatch(receivedItems(response.data));
      });
  };
}

this is currently what I have

describe('Items Action Creator', () => {
  it('should create a receiving items function', () => {
    expect(receivingItems()).to.be.a.function;
  });
});

Aucun commentaire:

Enregistrer un commentaire