UNPKG

declarative-promise

Version:

Behaves kinda like the es6 Promise api, but it doesn't actually *do* anything. It just produces a description of what is to be done, by someone else. At the moment, it's designed to work with the [redux-fetch](https://github.com/ashaffer/redux-fetch) mi

29 lines (22 loc) 534 B
/** * Imports */ import test from 'tape' import DeclarativePromise from '../src' /** * Tests */ test('should work', ({deepEqual, end}) => { function step () {} const q = new DeclarativePromise({}) q.step(step) deepEqual(q.toJSON(), {meta: {steps: [{success: step, failure: undefined, meta: {steps: []}}]}}) end() }) test('should return root from toJSON', ({deepEqual, end}) => { function step () {} const q = new DeclarativePromise({}) const q2 = q.step(step) deepEqual(q.toJSON(), q2.toJSON()) end() })