You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

api-client-mock

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-client-mock

This is mock super-agent api requests

1.0.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

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);

  });

});

Keywords

Superagent

FAQs

Package last updated on 11 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts