Nondeterministic Programming Methodology

npm

Join us for the upcoming webinar, "Enterprise JavaScript done right: the tools you love, the security you need."Sign up here »

unexpected-promise

1.3.0 • Public • Published

unexpected-promise

Plugin for the Unexpected assertion lib adding Promise support. Requires Unexpected 7 or above.

NPM version Build Status Coverage Status Dependency Status

An unexpected promise

var expect = require('unexpected').installPlugin(require('unexpected-promise'));
 
it('should DTRT', function () {
    return expect(myPromise, 'to be resolved with', 'foobar');
});
 
it('should fail', function () {
    return expect(myPromise, 'to be rejected with', new Error('argh'));
});

Alternatively you can use the when resolved and when rejected assertions to replace the subject with the resolved value or rejection reason, then apply another assertion to it:

it('should DTRT', function () {
    return expect(myPromise, 'when resolved', 'to equal', 'foobar');
});
 
it('should fail', function () {
    return expect(myPromise, 'when rejected', 'to have property', 'message', 'argh');
});

License

Unexpected-promise is licensed under a standard 3-clause BSD license -- see the LICENSE file for details.

install

npm i unexpected-promise

Downloadsweekly downloads

15

version

1.3.0

license

BSD

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability