Created
September 16, 2022 08:01
-
-
Save wokalski/bd14f52ed4568b601618a37f69fc32fd to your computer and use it in GitHub Desktop.
Nice jest bindings for rescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type expectException | |
type expect<'a, 'ret> | |
@module("@jest/globals") external describe: (string, unit => unit) => unit = "describe" | |
@module("@jest/globals") external test: (string, unit => unit) => unit = "test" | |
@module("@jest/globals") external testAsync: (string, unit => Js.Promise.t<unit>) => unit = "test" | |
@module("@jest/globals") external expect: 'a => expect<'a, unit> = "expect" | |
@module("@jest/globals") external expectF: (unit => 'a) => expect<expectException, unit> = "expect" | |
@module("@jest/globals") | |
external expectAsync: Js.Promise.t<'a> => expect<Js.Promise.t<'a>, Js.Promise.t<unit>> = "expect" | |
@get external not: expect<'a, 'ret> => expect<'a, 'ret> = "not" | |
@send external toEqual: (expect<'a, 'ret>, 'a) => 'ret = "toEqual" | |
@send external toBe: (expect<'a, 'ret>, 'a) => 'ret = "toBe" | |
@send external toBeNull: expect<'a, 'ret> => 'ret = "toBeNull" | |
@send external toBeDefined: expect<'a, 'ret> => 'ret = "toBeDefined" | |
@send external toBeUndefined: expect<'a, 'ret> => 'ret = "toBeUndefined" | |
@send external toBeTruthy: expect<'a, 'ret> => 'ret = "toBeTruthy" | |
@send external toBeFasly: expect<'a, 'ret> => 'ret = "toBeFasly" | |
@send external toMatch: (expect<string, 'ret>, Js.Re.t) => 'ret = "toMatch" | |
@send external toContain: (expect<array<'a>, 'ret>, 'a) => 'ret = "toContain" | |
@send external toThrow: expect<expectException, 'ret> => 'ret = "toThrow" | |
@send external fail: string => _ = "fail" | |
@send | |
external resolves: expect<Js.Promise.t<'a>, unit> => expect<'a, Js.Promise.t<unit>> = "resolves" | |
@send | |
external rejects: expect<Js.Promise.t<'a>, unit> => expect<_, Js.Promise.t<unit>> = "rejects" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment