Skip to content

Commit

Permalink
fix: update readme to remove spy
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Jan 13, 2018
1 parent 3931881 commit f060704
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,6 @@ results[0].expected.tersify()
tersify(results[0])
```

## spy(fn)

You can use `spy(fn)` to spy on function and record the calls.
It support 3 main case of async functions.
They are all converted to Promise syntax so you can get the result using `call[n].then(...)`

```ts
import { spy } from 'satisfier'

spy((a, b, cb) => { cb(a + 1, b - 1) })
spy((options) => { options.success() })
const spied = spy((a) => Promise.resolve(a + 1))
await spied.fn(1)
const callRecord = spied.calls[0]
t.is(callRecord.arguments[0], 1)
callRecord.then(result => t.is(result, 2))
```

## Contribute

```sh
Expand Down

0 comments on commit f060704

Please sign in to comment.