0.0.1 • Published 5 years ago
parcae v0.0.1
Introduction
parcae is a tiny utility allowing you to programmatically step through asynchronous code during test.
Some example where parcae can be handy:
- Test complex loading state on a user interface
- Reproduce race conditions
- Test any function containing non-trivial asynchronous logic
Installation
npm install --save parcae
import createFutures from "parcae"How to use
Initialize the utility
const futures = createFutures()mock the asynchronous functions you want to control making them return
futures.predict("aKey")make a function resolve and await for it by invoking
await futures.resolve("aKey", aResult)otherwise, make a function reject and await for it by invoking
await futures.reject("aKey", anError)