hamjest
Version:
A library of composable matchers for defining meaningful and readable assertions in JavaScript.
20 lines (17 loc) • 495 B
JavaScript
;
function deferMatcher(matcher) {
return {
matches: function (actual) {
return Promise.resolve().then(() => matcher.matches(actual));
},
describeTo: function (description) {
description.append('deferred: ');
matcher.describeTo(description);
},
describeMismatch: function (actual, description) {
description.append('deferred: ');
return Promise.resolve().then(() => matcher.describeMismatch(actual, description));
}
};
}
module.exports = deferMatcher;