0.1.1-alpha.0 • Published 5 years ago
@alexcardell/bs-supertest v0.1.1-alpha.0
bs-supertest
ReasonML bindings for supertest.
Installing
yarn add --dev @alexcardell/bs-supertest
Don't forget to @alexcardell/bs-supertest
to the bs-dev-dependencies
list in bsconfig.json
.
Note: Requires supertest as a peer dependency in package.json
(not in bsconfig.json
though).
Usage
An example with bs-jest
let message = err =>
err
|> Js.Exn.message
|> Belt.Option.getExn;
testAsync("a test", finish => {
let app = make(); /* Your Express server */
app
|> Supertest.request
|> Supertest.expectStatus(200)
|> Supertest.end_(
fun
| Ok(_) => finish(pass)
| Error(err) =>
message(err) |> fail |> finish
);
});
See the tests for more examples, and the source for all the bindings.
Contributions
Issues and PRs welcome.