[READ-ONLY] Mirror of https://github.com/Schniz/promise-null-object. Stubbing Promises for Node.js
0

Configure Feed

Select the types of activity you want to include in your feed.

JavaScript 100.0%
8 3 0

Clone this repository

https://tangled.org/schlez.in/promise-null-object https://tangled.org/did:plc:75p7kywx67a54wvlctqdeuqf
git@tangled.org:schlez.in/promise-null-object git@tangled.org:did:plc:75p7kywx67a54wvlctqdeuqf

For self-hosted knots, clone URLs may differ based on your setup.



README.md

Node.js Promise Null Objects for Testing#

Inspired by RSpec's stub.as_null_object, this module returns a new ES2015 Proxy that will fulfill your promises. Every property on the object returns a new, resolving promise. only catch and then will be the real implementation. The main usage will be to mock things like fetch or anything that is promise-based.

Installation#

npm install --save-dev promise-null-object

and your favorite test runner 😏

Short usage#

From the spec:

const promiseNullObject = require('promise-null-object');

it('works', () => {
  return promiseNullObject().a.b.c.d.e.f.g.h.i.then(e => e.a.b.c.d.ef.d.f.h());
});