hamjest
Version:
A library of composable matchers for defining meaningful and readable assertions in JavaScript.
24 lines (19 loc) • 498 B
JavaScript
;
const _create = require('lodash/create');
const _isFunction = require('lodash/isFunction');
const TypeSafeMatcher = require('./TypeSafeMatcher');
function IsPromise() {
return _create(new TypeSafeMatcher(), {
isExpectedType: function (actual) {
return actual && _isFunction(actual.then);
},
describeTo: function (description) {
description
.append('a promise');
}
});
}
IsPromise.promise = function () {
return new IsPromise();
};
module.exports = IsPromise;