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
- Host: GitHub
- URL: https://github.com/bloodyowl/rescript-spy
- Owner: bloodyowl
- License: mit
- Created: 2020-11-22T15:25:09.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-19T11:28:03.000Z (over 4 years ago)
- Last Synced: 2025-01-25T12:27:39.202Z (12 months ago)
- Language: ReScript
- Size: 31.3 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- Funding: .github/FUNDING.yml
- License: MIT-LICENSE
Awesome Lists containing this project
- awesome-list - rescript-spy
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)]
```