From e7049d3183752b7b858fe635ad50b2aa5c408808 Mon Sep 17 00:00:00 2001 From: ksvitkovsky Date: Wed, 9 Aug 2017 15:09:36 +0400 Subject: [PATCH] Add 'nothing' matcher and tests --- spec/core/matchers/nothingSpec.js | 8 ++++++++ src/core/matchers/nothing.js | 20 ++++++++++++++++++++ src/core/matchers/requireMatchers.js | 1 + 3 files changed, 29 insertions(+) create mode 100644 spec/core/matchers/nothingSpec.js create mode 100644 src/core/matchers/nothing.js diff --git a/spec/core/matchers/nothingSpec.js b/spec/core/matchers/nothingSpec.js new file mode 100644 index 00000000..8fefa119 --- /dev/null +++ b/spec/core/matchers/nothingSpec.js @@ -0,0 +1,8 @@ +describe('nothing', function() { + it('should pass', function() { + var matcher = jasmineUnderTest.matchers.nothing(), + result = matcher.compare(); + + expect(result.pass).toBe(true); + }); +}); diff --git a/src/core/matchers/nothing.js b/src/core/matchers/nothing.js new file mode 100644 index 00000000..625236b3 --- /dev/null +++ b/src/core/matchers/nothing.js @@ -0,0 +1,20 @@ +getJasmineRequireObj().nothing = function() { + /** + * {@link expect} nothing explicitly. + * @function + * @name matchers#nothing + * @example + * expect().nothing(); + */ + function nothing() { + return { + compare: function() { + return { + pass: true + }; + } + }; + } + + return nothing; +}; diff --git a/src/core/matchers/requireMatchers.js b/src/core/matchers/requireMatchers.js index 437a2b0f..0d365617 100644 --- a/src/core/matchers/requireMatchers.js +++ b/src/core/matchers/requireMatchers.js @@ -1,5 +1,6 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) { var availableMatchers = [ + 'nothing', 'toBe', 'toBeCloseTo', 'toBeDefined',