Skip to content

Commit 2219136

Browse files
committed
Add "should" style tests for iterable
1 parent 5fc6d53 commit 2219136

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/should.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,6 +2942,28 @@ describe('should', function() {
29422942
}, 'expected [ { a: 1 }, { b: 2 }, { c: 3 } ] to not be an ordered superset of [ { a: 1 }, { b: 2 } ]');
29432943
});
29442944

2945+
it ('iterable', function() {
2946+
([1, 2, 3]).should.be.iterable;
2947+
(new Map([[1, 'one'], [2, 'two'], [3, 'three']])).should.be.iterable;
2948+
(new Set([1, 2, 3])).should.be.iterable;
2949+
2950+
err(function() {
2951+
(42).should.be.iterable;
2952+
}, 'expected 42 to be an iterable');
2953+
2954+
err(function() {
2955+
('hello').should.be.iterable;
2956+
}, "expected 'hello' to be an iterable");
2957+
2958+
err(function() {
2959+
(true).should.be.iterable;
2960+
}, 'expected true to be an iterable');
2961+
2962+
err(function() {
2963+
({ key: 'value' }).should.be.iterable;
2964+
}, 'expected { key: \'value\' } to be an iterable');
2965+
})
2966+
29452967
it('change', function() {
29462968
var obj = { value: 10, str: 'foo' },
29472969
heroes = ['spiderman', 'superman'],

0 commit comments

Comments
 (0)