# @mt-testutils/mount-hoc

> A helper function for Jest unit tests that creates higher-order components

Latest version **1.0.8** (published 2018-10-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mt-testutils/mount-hoc
pnpm add @mt-testutils/mount-hoc
yarn add @mt-testutils/mount-hoc
bun add @mt-testutils/mount-hoc
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2018-10-09 |
| First published | 2018-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Patrick Hund |
| Maintainers | ninja.maass, pahund |

## Links

- npm: https://www.npmjs.com/package/@mt-testutils/mount-hoc
- npm.io page: https://npm.io/package/@mt-testutils/mount-hoc

## Dependencies (1)

- [@mt-testutils/mock-store](https://npm.io/package/@mt-testutils/mock-store.md) ^1.0.5

## Recent versions

- 1.0.8 (latest) — 2018-10-09
- 1.0.7 — 2018-10-09
- 1.0.6 — 2018-03-09

## README

# mount-hoc

Helper function that:

* creates a mockStore with given state
* connects the component to the Redux store
* mounts a component with [Enzyme](http://airbnb.io/enzyme/)
* allows to pass `contextTypes`, which will automatically added as props to the mounted component

## Installation

    npm install --save-dev @mt-testutils/mount-hoc
    
## Usage

    import mountHoc from '@mt-testutils/mount-hoc';
    import myHoc from './myHoc';
    
    // Props passed to the higher order component, defaults to {} if omitted
    const props = {
        someProp: 'some prop'
    };
    
    // Redux state, defaults to {} if omitted
    const state = {
        foo: 'bar'
    };
    
    // Component that is wrapped by the HOC, defaults to <div>wrapped</div>
    const WrappedComponent = <h1>Hello!!1!</h1>;
    
    mountHoc(myHoc, { props, state, WrappedComponent });
    
## Change Log

* See [CHANGELOG.md](CHANGELOG.md)

## Contribution Guidelines

* See [CONTRIBUTING.md](../../CONTRIBUTING.md)

## License

[MIT licensed](LICENSE)

Copyright © 2018 mobile.de GmbH

---
_Source: https://npm.io/package/@mt-testutils/mount-hoc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
