Skip to content

Commit

Permalink
Separating out these Set tests so they can all run when one fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 11, 2014
1 parent 4a53706 commit 8666cc7
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,14 +546,28 @@ describe('Collections', function() {
expect(Set.prototype).to.not.equal(Object.prototype);
});

it('should have an iterator that works with Array.from', function() {
set.add(1);
set.add(NaN);
set.add(false);
expect(Array.from(set)).to.eql([1, NaN, false]);
expect(Array.from(set.keys())).to.eql(Array.from(set));
expect(Array.from(set.values())).to.eql(Array.from(set));
expect(Array.from(set.entries())).to.eql([[1,1],[NaN,NaN],[false,false]]);
describe('has an iterator that works with Array.from', function() {
beforeEach(function() {
set.add(1);
set.add(NaN);
set.add(false);
});

it('works with the full set', function() {
expect(Array.from(set)).to.eql([1, NaN, false]);
});

it('works with Set#keys()', function() {
expect(Array.from(set.keys())).to.eql(Array.from(set));
});

it('works with Set#values()', function() {
expect(Array.from(set.values())).to.eql(Array.from(set));
});

it('works with Set#entries()', function() {
expect(Array.from(set.entries())).to.eql([[1,1],[NaN,NaN],[false,false]]);
});
});

describe('#forEach', function() {
Expand Down

0 comments on commit 8666cc7

Please sign in to comment.