@johanblumenberg/ts-mockito
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "@johanblumenberg/ts-mockito", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Mocking library for TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "lib/ts-mockito.js", |
@@ -6,2 +6,5 @@ # @johanblumenberg/ts-mockito | ||
- [Adding support for verify(...).timeout(ms)](https://github.com/NagRock/ts-mockito/pull/97) | ||
- [Matcher types](https://github.com/NagRock/ts-mockito/pull/139) | ||
- [Mock free functions](https://github.com/NagRock/ts-mockito/pull/140) | ||
- [Add defer() for testing deferred promise resolution](https://github.com/NagRock/ts-mockito/pull/141) | ||
@@ -73,8 +76,8 @@ ## Installation | ||
### Delay resolving promises | ||
### Defer resolving promises | ||
The actions `.thenResolve()` and `.thenReject()` are returning promises that are already resolved or rejected. Sometimes you want to control the order or timing of when promises are resolved. In that case it is useful to return a delayed promise, and resolve it from the test code, when appropriate. | ||
The actions `.thenResolve()` and `.thenReject()` are returning promises that are already resolved or rejected. Sometimes you want to control the order or timing of when promises are resolved. In that case it is useful to return a deferred promise, and resolve it from the test code, when appropriate. | ||
```typescript | ||
let d = delayed<number>(); | ||
let d = defer<number>(); | ||
when(obj.method()).thenReturn(d); // Return a promise that is not resolved yet | ||
@@ -81,0 +84,0 @@ |
141231
417