# @mojotech/prismatest-enzyme

> Enzyme adapter for use with @mojotech/prismatest

Latest version **0.2.7** (published 2020-02-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mojotech/prismatest-enzyme
pnpm add @mojotech/prismatest-enzyme
yarn add @mojotech/prismatest-enzyme
bun add @mojotech/prismatest-enzyme
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2020-02-28 |
| First published | 2019-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mojotech |
| Maintainers | cpjolicoeur, danielwilsonthomas-mj, mulias |

## Links

- npm: https://www.npmjs.com/package/@mojotech/prismatest-enzyme
- npm.io page: https://npm.io/package/@mojotech/prismatest-enzyme

## Dependencies (2)

- [enzyme](https://npm.io/package/enzyme.md) ^3.9.0
- [@mojotech/prismatest](https://npm.io/package/@mojotech/prismatest.md) ^0.3.1

## Recent versions

- 0.2.7 (latest) — 2020-02-28
- 0.2.6 — 2019-09-11
- 0.2.5 — 2019-09-11
- 0.2.4 — 2019-08-28
- 0.2.3 — 2019-08-28
- 0.2.2 — 2019-08-27
- 0.2.1 — 2019-08-26
- 0.2.0 — 2019-08-26
- 0.1.1 — 2019-07-07
- 0.1.0 — 2019-07-05

## README

# Prismatest Enzyme Adapter

This adapter is used to interact with your test views using Enzyme.

## Element Type

Elements are interacted with using Enzyme's
[ReactWrapper](https://airbnb.io/enzyme/docs/api/mount.html#reactwrapper-api)
class.

## Selector Type

Selectors are specified using the `Selector` class. This class wraps a function that takes the current
element that has been selected and may call methods on it to narrow down the
selection further. For example:

```
import { Selector } from '@mojotech/prismatest-enzyme';

new Selector(e => e.find('.cool-class'))
```

### Selector Helper

A helper function is provided that takes the same arguments as the
[find](https://airbnb.io/enzyme/docs/api/ReactWrapper/find.html) method on
ReactWrapper instances. It is essentially just a wrapper around that method.

```typescript
selector: (enzymeSelector) => SelectorType
```

## Quick Start

1. Install

    ```bash
    yarn install --dev @mojotech/prismatest-enzyme
    ```

2. Render something

    ```javascript
    import App from "./app";
    import { mount } from "enzyme";

    const rendered = mount(<App />);
    ```

3. Use some test views

    ```javascript
    import testView, { selector } from "@mojotech/prismatest-enzyme";
    import TodoComponent from './todo-component';

    const TodoView = testView(selector(TodoComponent), { addTodo: (e, text) => e.props().addTodo(text) });

    const todo = TodoView.materialize(rendered);

    todo.addTodo("Write some tests!");
    ```

---
_Source: https://npm.io/package/@mojotech/prismatest-enzyme · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
