2.2.1 • Published 4 years ago

reason-jest v2.2.1

Weekly downloads
140
License
MIT
Repository
github
Last release
4 years ago

re-jest

Jest bindings in ReasonML

This is a set of bindings to jest in ReasonML, It aims to be simpler to use than bs-jest, with most functions returning unit, enabling a developer to write their tests with the same approach they would take writing them in JavaScript, but without needing to leave the type safety of ReasonML.

describe("myTests", () => {
  test("numbers", () => {
    let myNumber = 123;
    expect(myNumber)->toBeGreaterThan(100);
    expect(myNumber)->not->toBeLessThanOrEqual(1);

    // It also works for floats...
    expect(myNumber->float_of_int)->toBeLessThan(124.0);
  });

  testAsync("promises", () => {
    expect(Js.Promise.resolve(123))->resolves->toEqual(123);
  });

  test("arrays", () => {
    expect([|1, 2, 3, 4, 5|])->toContain(4);
  });

  // Still working on this one...
  Skip.test("billion dollar idea generator",
    () =>
      expect(generateBillionDollarCompany()->valuation)
      ->toBeGreaterThan(1000000000)
  );
});

Stability

Very much a work in progress, but nonetheless it can do enough to test plenty of existing code.

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago