Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed May 17, 2024
1 parent 61a5585 commit 1a62a1f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ console.log(spied.calls) // []
console.log(spied.returns) // []
```

Since 3.0, tinyspy doesn't unwrap the Promise in `returns` anymore, so you need to await it manually:
Since 3.0, tinyspy doesn't unwrap the Promise in `returns` and `results` anymore, so you need to await it manually:

```js
const spied = spy(async (n) => n + '!')

const promise = spied('a')

console.log(spied.called) // true
console.log(spied.returns) // ['ok', Promise<'a!'>]
console.log(spied.results) // ['ok', Promise<'a!'>]

await promise

console.log(spied.returns) // ['ok', Promise<'a!'>]
console.log(spied.results) // ['ok', Promise<'a!'>]

console.log(await spied.returns[0]) // 'a!'
console.log(await spied.results[0]) // 'a!'
```

> [!WARNING]
Expand Down

0 comments on commit 1a62a1f

Please sign in to comment.