jest-mock-promise
Advanced tools
Comparing version 1.1.8 to 1.1.9
{ | ||
"name": "jest-mock-promise", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "Synchronous Promise Mock for testing with Jest", | ||
@@ -5,0 +5,0 @@ "main": "dist/jest-mock-promise.js", |
@@ -22,2 +22,19 @@ # What's this? | ||
# API | ||
The API of this synchronous promise matches the one of the regular Promise, with two additional instance methods (attached to an instance of the Promise): | ||
* `resolve` - resolves a promise instance | ||
* `reject` - rejects a promise instance | ||
This methods do the same job as the ones passed to the main callback function: | ||
```javascript | ||
new Promise((resolve, reject) => { resolve(1,2); }); | ||
``` | ||
Having them attached to the instance enables us to call them outside the callback function, which makes our code much more readable: | ||
```javascript | ||
let promise = new Promise(); | ||
promise.resolve(1,2); | ||
``` | ||
# How does it work - Examples | ||
@@ -191,20 +208,3 @@ | ||
# API | ||
The API of this synchronous promise matches the one of the regular Promise, with two additional instance methods (attached to an instance of the Promise): | ||
* `resolve` - resolves a promise instance | ||
* `reject` - rejects a promise instance | ||
This methods do the same job as the ones passed to the main callback function: | ||
```javascript | ||
new Promise((resolve, reject) => { resolve(1,2); }); | ||
``` | ||
Having them attached to the instance enables us to call them outside the callback function, which makes our code much more readable: | ||
```javascript | ||
let promise = new Promise(); | ||
promise.resolve(1,2); | ||
``` | ||
# License | ||
MIT License, http://www.opensource.org/licenses/MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package