unexpected
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -626,5 +626,5 @@ // Copyright (c) 2013 Sune Simonsen <sune@we-knowhow.dk> | ||
var errors = []; | ||
forEach(getKeys(obj), function (key) { | ||
forEach(getKeys(obj), function (key, index) { | ||
try { | ||
callback(obj[key]); | ||
callback(obj[key], index); | ||
} catch (e) { | ||
@@ -631,0 +631,0 @@ errors.push(' ' + key + ': ' + e.message.replace(/\n/g, '\n ')); |
{ | ||
"name": "unexpected", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -310,3 +310,3 @@ # Unexpected | ||
```js | ||
expect([0, 1, 2, 3, 4], 'to be an array whose items satisfy', function (item) { | ||
expect([0, 1, 2, 3, 4], 'to be an array whose items satisfy', function (item, index) { | ||
expect(item, 'to be a number'); | ||
@@ -313,0 +313,0 @@ }); |
@@ -678,8 +678,10 @@ /*global describe, it, expect*/ | ||
it('asserts that the given callback does not throw for any items in the array', function () { | ||
expect([0,1,2,3], 'to be an array whose items satisfy', function (item) { | ||
expect([0,1,2,3], 'to be an array whose items satisfy', function (item, index) { | ||
expect(item, 'to be a number'); | ||
expect(index, 'to be a number'); | ||
}); | ||
expect(['0','1','2','3'], 'to be an array whose items satisfy', function (item) { | ||
expect(['0','1','2','3'], 'to be an array whose items satisfy', function (item, index) { | ||
expect(item, 'not to be a number'); | ||
expect(index, 'to be a number'); | ||
}); | ||
@@ -694,2 +696,10 @@ | ||
it('provides the item index to the callback function', function () { | ||
var arr = ['0','1','2','3']; | ||
expect(arr, 'to be an array whose items satisfy', function (item, index) { | ||
expect(index, 'to be a number'); | ||
expect(index, 'to be', arr.indexOf(item)); | ||
}); | ||
}); | ||
it('fails when the assertion fails', function () { | ||
@@ -696,0 +706,0 @@ expect(function () { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
231463
6819