# @greenlabs/rescript-testing-library

> ReScript bindings for @testing-library

Latest version **2.0.1** (published 2022-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @greenlabs/rescript-testing-library
pnpm add @greenlabs/rescript-testing-library
yarn add @greenlabs/rescript-testing-library
bun add @greenlabs/rescript-testing-library
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2022-11-21 |
| First published | 2022-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 49.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 49 |
| Author | Greenlabs Dev |
| Maintainers | minukang, gyeop, miryangjung, jaeholee.gl, namenu, moondaddi, yousleepwhen, kimchhickey |
| Keywords | ReScript, @testing-library |

## Links

- npm: https://www.npmjs.com/package/@greenlabs/rescript-testing-library
- Repository: https://github.com/green-labs/rescript-bindings
- Homepage: https://github.com/green-labs/rescript-bindings#readme
- Issues: https://github.com/green-labs/rescript-bindings/issues
- npm.io page: https://npm.io/package/@greenlabs/rescript-testing-library

## 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
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2022-11-21
- 2.0.0 — 2022-10-10
- 1.0.0 — 2022-09-29
- 0.11.0 — 2022-09-21
- 0.10.1 — 2022-09-20

## README

# `rescript-testing-library`

## Install

```bash
npm i @greenlabs/rescript-testing-library --dev
or
yarn add @greenlabs/rescript-testing-library --dev
```

```json
"bs-dev-dependencies": [
  "@greenlabs/rescript-testing-library"
]
```

## Usage

```rescript
module TestComponent = {
  @react.component
  let make = () => {
    let (show, setShow) = React.useState(_ => false)
    <div>
      <button type_="button" onClick={_ => setShow(prev => !prev)}>
        {`Toggle`->React.string}
      </button>
      {show ? <h1 title="my_title"> {`Hello World`->React.string} </h1> : React.null}
    </div>
  }
}

open! Jest
open! Expect
open! TestingLibrary.JestExpect
open! TestingLibrary.Dom

module Event = TestingLibrary.Event

testPromise("use jest dom", async () => {
  let userEvent = Event.setup()

  TestingLibrary.React.render(<TestComponent />)->ignore

  expect(screen->ByTitle.query("my_title"))->not->toBeInTheDocument
  await TestingLibrary.React.actPromise(async () => {
    await (userEvent->Event.click(screen->ByText.get("Toggle")))
  })
  expect(screen->ByTitle.get("my_title")->Some)->toBeInTheDocument
})
```

---
_Source: https://npm.io/package/@greenlabs/rescript-testing-library · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
