BuckleScript bindings for jest-dom.
npm install bs-jest-dom> BuckleScript bindings for jest-dom.
``sh
$ yarn add --dev bs-jest-dom
$ npm install --save-dev bs-jest-dom
`
#### Add to bsconfig.json
`json`
{
"bs-dev-dependencies": ["bs-jest-dom"]
}
#### With bs-jest and bs-react-testing-library
`ocaml
/ Heading_test.re /
open Jest;
open JestDom;
open ReactTestingLibrary;
module Heading = {
[@react.component]
let make = (~text) =>
test("renders in the document", () =>
|> render
|> getByText(~matcher=Str("Hello, World!"))
|> expect
|> toBeInTheDocument
);
``
#### With bs-jest and bs-webapi
`ocaml
/ Heading_test.re /
open Jest;
open JestDom;
open Webapi.Dom;
open Webapi.Dom.Element;
test("heading is visible", () => {
let div = Document.createElement("div", document);
div->setInnerHTML("
div
|> querySelector("h1")
|> expect
|> toBeVisible;
});
`
See src/__tests__ for some examples.
`shnpm install
$ git clone https://github.com/wyze/bs-jest-dom.git
$ cd bs-jest-dom
$ yarn # or `
`sh`
$ yarn build
`sh``
$ yarn test
* Fix JSX and bs-webapi to compile on BS 8 (@johnridesabike in #20)
MIT © Neil Kistner
[actions-image]: https://img.shields.io/github/workflow/status/wyze/bs-jest-dom/CI.svg?style=flat-square
[actions-url]: https://github.com/wyze/bs-jest-dom/actions
[npm-image]: https://img.shields.io/npm/v/bs-jest-dom.svg?style=flat-square
[npm-url]: https://npm.im/bs-jest-dom
[codecov-image]: https://img.shields.io/codecov/c/github/wyze/bs-jest-dom.svg?style=flat-square
[codecov-url]: https://codecov.io/github/wyze/bs-jest-dom