1.0.3 • Published 7 years ago

api-client-mock v1.0.3

Weekly downloads
6
License
ISC
Repository
github
Last release
7 years ago

This is mock for super-agent api requests

import configureStore from 'redux-mock-store';
import clientMiddleware from 'redux/middleware/clientMiddleware'; // you clientMiddleware if you need them
import ApiClient from 'api-client-mock';

const middlewares = [clientMiddleware(new ApiClient())];
const mockStore = configureStore(middlewares);

export default mockStore;
import { response } from 'api-client-mock';
import mockStore from 'tests/mock/store.mock';

/** @test {src/redux/modules/notifications/notifications.js~load} */
it('should async success load be correct', () => {

  const store = mockStore({});

  const loadAction = {
    type: LOAD_REQUEST,
  };

  const loadSuccessAction = {
    type: LOAD_SUCCESS,
    result: {},
  };

  response.register('/notifications', 'get', () => loadSuccessAction.result);

  return store.dispatch(load()).then(() => {

    expect(store.getActions()[0]).toEqual(loadAction);
    expect(store.getActions()[1]).toEqual(loadSuccessAction);

  });

});
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago