# marty-test-utils

> marty.js test utils

Latest version **0.4.0** (published 2015-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install marty-test-utils
pnpm add marty-test-utils
yarn add marty-test-utils
bun add marty-test-utils
```

## 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.4.0 |
| Published | 2015-04-29 |
| First published | 2015-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Darío Javier Cravero |
| Maintainers | dariocravero |
| Keywords | marty.js, test, utils |

## Links

- npm: https://www.npmjs.com/package/marty-test-utils
- Repository: https://github.com/dariocravero/marty-test-utils
- Issues: https://github.com/dariocravero/marty-test-utils/issues
- npm.io page: https://npm.io/package/marty-test-utils

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2015-04-29
- 0.3.0 — 2015-04-27
- 0.2.2 — 2015-04-24
- 0.2.1 — 2015-04-24
- 0.2.0 — 2015-04-24
- 0.1.0 — 2015-04-23

## README

# marty-test-utils

A bunch of helpers to aid [marty](https//martyjs.org) testing.

[![Build Status](https://travis-ci.org/dariocravero/marty-test-utils.svg?branch=master)](https://travis-ci.org/dariocravero/marty-test-utils)

## mockStore

Use it to fake a Store.

```js
mockStore('MyStore', {
  method1: spy()
});
```

## mockComponent

Use it to fake a React component.

```js
mockComponent('Test'); // => <div></div>
mockComponent('Test', 'span'); // => <span></span>
```

## onDispatchedAction

Use it to test actions triggered through a dispatcher inside `ActionCreators` and `Queries`.

```
const dispatcher = Marty.dispatcher.getDefault();

it('tests a dispatched action', (done) => {
  onDispatchedAction(dispatcher, wcheck(done, (payload) => {
    assert(true); // <-- here go your tests
  }));

  ActionCreators.doSomething();
});
```

## onStoreChange

Use it to test `Store` changes after the actions were handled.

```
const dispatcher = Marty.dispatcher.getDefault();

it('tests a store change', (done) => {
  onStoreChange(Store, wcheck(done, (state) => {
    assert(true); // <-- here go your tests
  }));

  // Fake the dispatcher emitting an action
  dispatcher.dispatchAction({type: Mock.Constants.USER_SET_EMAIL, arguments: [EMAIL]});
});
```

MIT license.

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