An open API service indexing awesome lists of open source software.

https://github.com/bloodyowl/rescript-spy

Test utility to check function calls
https://github.com/bloodyowl/rescript-spy

Last synced: 9 days ago
JSON representation

Test utility to check function calls

Awesome Lists containing this project

README

          

# ReScript Spy

> Test utility to check function calls

## Install

```console
$ yarn add rescript-spy
```

Then, add it to you're `rescript.json`'s dev dependencies:

```diff
"bs-dev-dependencies": [
+ "rescript-spy"
]
```

## Usage

```rescript
let (spy, calls) = Spy.make2((a, b) => a + b)

let _ = spy(1, 2)
let _ = spy(2, 3)

calls // [(1, 2), (2, 3)]
Spy.clear(calls)

let _ = spy(3, 4)
calls // [(3, 4)]
```