ReScript bindings for @testing-library/react
npm install rescript-react-testing-library

!Codecov
ReScript bindings for testing-library/react.
``bash`
npm install --save-dev rescript-react-testing-libraryor yarn
yarn add --dev rescript-react-testing-library
Update your bsconfig file:
`json`
{
"bs-dev-dependencies": ["rescript-react-testing-library"]
}
`res
open Jest
open Expect
open ReactTestingLibrary
// Make it pipe-first:
let toMatchSnapshot = a => a |> Expect.toMatchSnapshot
module DummyComponent = {
@react.component
let make = () => {
describe("DummyComponent", () => {
beforeEach(() => {
})
test("render Red option", () => {
screen
->getByRole(~matcher=#Str("option"), ~options=makeByRoleOptions(~name="Red", ()))
->expect
->toMatchSnapshot
})
test("render Green option", () => {
screen
->getByRole(~matcher=#Str("option"), ~options=makeByRoleOptions(~name="Green", ()))
->expect
->toMatchSnapshot
})
test("render Blue option", () => {
screen
->getByRole(~matcher=#Str("option"), ~options=makeByRoleOptions(~name="Blue", ()))
->expect
->toMatchSnapshot
})
})
``