UNPKG

hamjest

Version:

A library of composable matchers for defining meaningful and readable assertions in JavaScript.

23 lines (18 loc) 437 B
'use strict'; const _ = require('lodash'); 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;