Added matchers: truthy, falsy, empty and notEmpty

This commit is contained in:
sjolicoeur
2017-12-05 13:04:29 -08:00
committed by pivotal
parent 0183b1642d
commit d90e20eb15
11 changed files with 363 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
getJasmineRequireObj().NotEmpty = function (j$) {
function NotEmpty() {}
NotEmpty.prototype.asymmetricMatch = function (other) {
if (typeof other === 'string') {
return other.length !== 0;
}
if (other instanceof Array) {
return other.length !== 0;
}
if (typeof Map !== 'undefined' && other instanceof Map) {
return other.size !== 0;
}
if (typeof Set !== 'undefined' && other instanceof Set) {
return other.size !== 0;
}
if (other instanceof Object) {
return Object.keys(other).length !== 0;
}
return false;
};
NotEmpty.prototype.jasmineToString = function () {
return '<jasmine.notEmpty>';
};
return NotEmpty;
};