package melange-fest

  1. Overview
  2. Docs
A minimal test framework for Melange

Install

Dune Dependency

Authors

Maintainers

Sources

melange-fest-0.1.0.tbz
sha256=34f8c000dfee70dda1838c600584e6b6f67f7de1a230b2a46d1bc024c50e1afb
sha512=63d29ab4434a4c3de24ff8c86fd01c114f3a9b068e568f7848b2ff63086bc0a6526493e21c18e4d12067e7f8fa85872de514d828a30d2ce49cfc5a5acbc6014d

README.md.html

melange-fest

A minimal test framework for Melange using Node test runner.

Quick Start

open Fest

test("1+1=2", () => expect |> equal(1 + 1, 2));

React

React support is provided by reason-react.

open Fest;
module RTL = ReactTestingLibrary;
[@mel.get] external textContent: Dom.element => string = "textContent";

Domloader.init();

module Hello = {
  [@react.component]
  let make = (~text) => <div> {"Hello " ++ text |> React.string} </div>;
};

let () =
  test("test component", () => {
    let result = RTL.render(<Hello text="Nila" />);

    // Check that Hello component renders the name properly.
    let el = RTL.getByText(~matcher=`Str("Hello Nila"), result);
    expect |> equal(textContent(el), "Hello Nila");
  });

Commands

Run all tests:

make test
OCaml

Innovation. Community. Security.