Add anything matcher to match any value that is neither null or undefined
[finish #58117878] Fix #186
This commit is contained in:
10
src/core/Anything.js
Normal file
10
src/core/Anything.js
Normal file
@@ -0,0 +1,10 @@
|
||||
getJasmineRequireObj().Anything = function(j$) {
|
||||
|
||||
function Anything() {}
|
||||
|
||||
Anything.prototype.asymmetricMatch = function(other) {
|
||||
return !j$.util.isUndefined(other) && other !== null;
|
||||
};
|
||||
|
||||
return Anything;
|
||||
};
|
||||
@@ -45,6 +45,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return new j$.Any(clazz);
|
||||
};
|
||||
|
||||
j$.anything = function() {
|
||||
return new j$.Anything();
|
||||
};
|
||||
|
||||
j$.objectContaining = function(sample) {
|
||||
return new j$.ObjectContaining(sample);
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@ getJasmineRequireObj = (function (jasmineGlobal) {
|
||||
jRequire.base(j$, jasmineGlobal);
|
||||
j$.util = jRequire.util();
|
||||
j$.Any = jRequire.Any();
|
||||
j$.Anything = jRequire.Anything(j$);
|
||||
j$.CallTracker = jRequire.CallTracker();
|
||||
j$.MockDate = jRequire.MockDate();
|
||||
j$.Clock = jRequire.Clock();
|
||||
|
||||
Reference in New Issue
Block a user