bs-jest-dom is a companion library for bs-react-testing-library that provides custom DOM element matchers for Jest in ReasonML via BuckleScript.

npm install --save-dev bs-jest-dom

Check out jest-dom's documentation for a full list of available matchers.


"bs-dev-dependencies": ["bs-jest-dom"]


/* */
open Jest;
open JestDom;
open ReactTestingLibrary;
module Heading = {
let component = ReasonReact.statelessComponent("Heading");
let make = (~text, _children) => {
render: _self =>
<h1> {ReasonReact.string(text)} </h1>,
test("renders with text", () =>
<Heading text="Hello, World!" />
|> render
|> getByText(~matcher=`Str("Hello, World!"))
|> expect
|> toBeInTheDocument

More Examples

You can find more bs-jest-dom examples at wyze/bs-jest-dom/src/__tests__.

Last updated on by Matan Borenkraout