1.3.0 • Published 10 years ago

unexpected-promise v1.3.0

Weekly downloads
1
License
BSD
Repository
github
Last release
10 years ago

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.

1.3.0

10 years ago

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago