Add arrayWithExactContents asymmetric matcher

- Fixes #817
This commit is contained in:
Gregg Van Hove
2017-08-04 12:07:09 -07:00
parent 8c0a8a1b33
commit 8ad9abb19a
7 changed files with 149 additions and 8 deletions

View File

@@ -4,8 +4,9 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
}
ArrayContaining.prototype.asymmetricMatch = function(other, customTesters) {
var className = Object.prototype.toString.call(this.sample);
if (className !== '[object Array]') { throw new Error('You must provide an array to arrayContaining, not \'' + this.sample + '\'.'); }
if (!j$.isArray_(this.sample)) {
throw new Error('You must provide an array to arrayContaining, not ' + j$.pp(this.sample) + '.');
}
for (var i = 0; i < this.sample.length; i++) {
var item = this.sample[i];