Skip to content

Commit

Permalink
Add "should" style tests for iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
koddsson committed Jan 28, 2024
1 parent 5fc6d53 commit 2219136
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/should.js
Original file line number Diff line number Diff line change
Expand Up @@ -2942,6 +2942,28 @@ describe('should', function() {
}, 'expected [ { a: 1 }, { b: 2 }, { c: 3 } ] to not be an ordered superset of [ { a: 1 }, { b: 2 } ]');
});

it ('iterable', function() {
([1, 2, 3]).should.be.iterable;
(new Map([[1, 'one'], [2, 'two'], [3, 'three']])).should.be.iterable;
(new Set([1, 2, 3])).should.be.iterable;

err(function() {
(42).should.be.iterable;
}, 'expected 42 to be an iterable');

err(function() {
('hello').should.be.iterable;
}, "expected 'hello' to be an iterable");

err(function() {
(true).should.be.iterable;
}, 'expected true to be an iterable');

err(function() {
({ key: 'value' }).should.be.iterable;
}, 'expected { key: \'value\' } to be an iterable');
})

it('change', function() {
var obj = { value: 10, str: 'foo' },
heroes = ['spiderman', 'superman'],
Expand Down

0 comments on commit 2219136

Please sign in to comment.