Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bs-jest-dom

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-jest-dom

BuckleScript bindings for jest-dom.

  • 4.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
621
increased by44.42%
Maintainers
1
Weekly downloads
 
Created
Source

bs-jest-dom · Build Status npm Codecov

BuckleScript bindings for jest-dom.

Installation

$ yarn add --dev bs-jest-dom

# or..

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

Usage

Add to bsconfig.json
{
  "bs-dev-dependencies": ["bs-jest-dom"]
}
With bs-jest and bs-react-testing-library
/* Heading_test.re */

open Jest;
open JestDom;
open ReactTestingLibrary;

module Heading = {
  [@react.component]
  let make = (~text) => <h1> {ReasonReact.string(text)} </h1>;
};

test("renders in the document", () =>
  <Heading text="Hello, World!" />
  |> render
  |> getByText(~matcher=`Str("Hello, World!"))
  |> expect
  |> toBeInTheDocument
);
With bs-jest and bs-webapi
/* 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("<h1>Hello, World!</h1>");

  div
  |> querySelector("h1")
  |> expect
  |> toBeVisible;
});

Examples

See src/__tests__ for some examples.

Development

$ git clone https://github.com/wyze/bs-jest-dom.git
$ cd bs-jest-dom
$ yarn # or `npm install`

Build

$ yarn build

Test

$ yarn test

Change Log

Full Change Log

v4.0.0 (2020-04-21)

  • Update readme.md (@wyze in 40ba55b)
  • Convert matchers to externals (@wyze in #17)

License

MIT © Neil Kistner

Keywords

FAQs

Package last updated on 22 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc