Skip to content

Commit

Permalink
Remove the "to be an array of"... assertions.
Browse files Browse the repository at this point in the history
Luckily they weren't documented.

Fixes #145.
  • Loading branch information
papandreou committed Apr 12, 2015
1 parent efe3ce1 commit 08e35fa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
14 changes: 0 additions & 14 deletions lib/assertions.js
Expand Up @@ -454,20 +454,6 @@ module.exports = function (expect) {
return expect.apply(expect, [subject, 'to have values satisfying'].concat(extraArgs));
});

expect.addAssertion('array-like', 'to be an array of', function (expect, subject, itemType) {
this.errorMode = 'nested';
expect(subject, 'to be non-empty');
this.errorMode = 'default';
expect(subject, 'to have items satisfying', 'to be a', itemType);
});

expect.addAssertion('array-like', 'to be an array of (strings|numbers|booleans|arrays|objects|functions|regexps|regexes|regular expressions)', function (expect, subject) {
this.errorMode = 'nested';
expect(subject, 'to be non-empty');
this.errorMode = 'default';
expect(subject, 'to be an array of', this.alternations[0].replace(/e?s$/, ''));
});

expect.addAssertion('object', [
'to have keys satisfying',
'to be (a map|a hash|an object) whose (keys|properties) satisfy'
Expand Down
23 changes: 0 additions & 23 deletions test/unexpected.spec.js
Expand Up @@ -323,29 +323,6 @@ describe('unexpected', function () {
});
});

describe('to a an array of assertion', function () {
it('fails if the given array is empty', function () {
expect(function () {
expect([], 'to be an array of strings');
}, 'to throw',
"expected [] to be an array of strings\n" +
" expected [] to be non-empty");
});

it('asserts that all items in the array has the specified type', function () {
expect(['abc'], 'to be an array of strings');
expect([{}], 'to be an array of objects');
expect([/foo/, /bar/], 'to be an array of regexps');
expect([/foo/, /bar/], 'to be an array of regexes');
});

it('fails if any item in the array has another type than what is expected', function () {
expect(function () {
expect(['abc', 123], 'to be an array of strings');
}, 'to throw', "expected [ 'abc', 123 ] to be an array of strings");
});
});

describe('equal assertion', function () {
it('asserts deep equality that works with objects', function () {
expect({ a: 'b' }, 'to equal', { a: 'b' });
Expand Down

0 comments on commit 08e35fa

Please sign in to comment.