# redux-promise-mock

> Middleware meant to be used with Redux Promise that can be used to mock remote API calls with mock data.

Latest version **0.1.1** (published 2016-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-promise-mock
pnpm add redux-promise-mock
yarn add redux-promise-mock
bun add redux-promise-mock
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-06-13 |
| First published | 2016-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Eric Masiello |
| Maintainers | ericmasiello |
| Keywords | redux, promise, middleware, flux, mock |

## Links

- npm: https://www.npmjs.com/package/redux-promise-mock
- Repository: https://ericmasiello@github.com/ericmasiello/Redux-Promise-Mock
- Homepage: https://github.com/ericmasiello/Redux-Promise-Mock#readme
- Issues: https://github.com/ericmasiello/Redux-Promise-Mock/issues
- npm.io page: https://npm.io/package/redux-promise-mock

## Alternatives

- [@reckona/mreact-store](https://npm.io/package/@reckona/mreact-store.md) — 976 weekly downloads
- [regular-state](https://npm.io/package/regular-state.md) — 410 weekly downloads
- [@pacote/flux-actions](https://npm.io/package/@pacote/flux-actions.md) — 65 weekly downloads
- [@pilotlab/lux-debug](https://npm.io/package/@pilotlab/lux-debug.md) — 39 weekly downloads
- [vue-persist-state](https://npm.io/package/vue-persist-state.md) — 19 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2016-06-13
- 0.1.0 — 2016-06-12
- 0.0.5 — 2016-06-12
- 0.0.4 — 2016-06-12
- 0.0.3 — 2016-06-12
- 0.0.2 — 2016-06-12
- 0.0.1 — 2016-06-12

## README

# Redux-Promise-Mock
Middleware meant to be used with Redux Promise that can be used to mock remote API calls with mock data.

This middleware will automatically return mock data whenever the API promise-based request executed via `redux-promise` (https://github.com/acdlite/redux-promise) throws an error.

## Basic Usage

Import `createMockMiddleware` wherever you create your Redux store middleware.
```js
import { createMockMiddleware } from 'redux-promise-mock';
```

Call the `createMockMiddleware`, passing it an object where the keys match action types that will be dispatched to your Redux reducers where you wish to mock the data that's returned.
```js
const mockData = createMockMiddleware({
  LOAD_CONTACT_DETAIL: {
    ID: 1,
    name: 'Eric',
    email: 'eric@email.com'
  },
  LOAD_CONTACT_LIST: [
    {
      ID: 1,
      name: 'Eric',
      email: 'eric@email.com'
    },
    {
      ID: 2,
      name: 'Hyun',
      email: 'hyun@email.com'
    }
  ]
});
```

Use Redux's `applyMiddleware` to attach your newly created `mockData` middleware.

```js
applyMiddleware(ReduxPromise, mockData);
```

---
_Source: https://npm.io/package/redux-promise-mock · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
