Skip to content

Commit

Permalink
Add tests for index parameter for map and forEach method
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Mazurek committed May 23, 2016
1 parent 3dfbd45 commit b7e46e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/ReactWrapper-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1778,10 +1778,13 @@ describeWithDOM('mount', () => {
expect(spy.callCount).to.equal(3);
expect(spy.args[0][0]).to.be.instanceOf(ReactWrapper);
expect(spy.args[0][0].hasClass('bax')).to.equal(true);
expect(spy.args[0][1]).to.equal(0);
expect(spy.args[1][0]).to.be.instanceOf(ReactWrapper);
expect(spy.args[1][0].hasClass('bar')).to.equal(true);
expect(spy.args[1][1]).to.equal(1);
expect(spy.args[2][0]).to.be.instanceOf(ReactWrapper);
expect(spy.args[2][0].hasClass('baz')).to.equal(true);
expect(spy.args[2][1]).to.equal(2);
});
});

Expand All @@ -1801,10 +1804,13 @@ describeWithDOM('mount', () => {
expect(spy.callCount).to.equal(3);
expect(spy.args[0][0]).to.be.instanceOf(ReactWrapper);
expect(spy.args[0][0].hasClass('bax')).to.equal(true);
expect(spy.args[0][1]).to.equal(0);
expect(spy.args[1][0]).to.be.instanceOf(ReactWrapper);
expect(spy.args[1][0].hasClass('bar')).to.equal(true);
expect(spy.args[1][1]).to.equal(1);
expect(spy.args[2][0]).to.be.instanceOf(ReactWrapper);
expect(spy.args[2][0].hasClass('baz')).to.equal(true);
expect(spy.args[2][1]).to.equal(2);
});

it('should return an array with the mapped values', () => {
Expand Down
6 changes: 6 additions & 0 deletions test/ShallowWrapper-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1712,10 +1712,13 @@ describe('shallow', () => {
expect(spy.callCount).to.equal(3);
expect(spy.args[0][0]).to.be.instanceOf(ShallowWrapper);
expect(spy.args[0][0].hasClass('bax')).to.equal(true);
expect(spy.args[0][1]).to.equal(0);
expect(spy.args[1][0]).to.be.instanceOf(ShallowWrapper);
expect(spy.args[1][0].hasClass('bar')).to.equal(true);
expect(spy.args[1][1]).to.equal(1);
expect(spy.args[2][0]).to.be.instanceOf(ShallowWrapper);
expect(spy.args[2][0].hasClass('baz')).to.equal(true);
expect(spy.args[2][1]).to.equal(2);
});
});

Expand All @@ -1735,10 +1738,13 @@ describe('shallow', () => {
expect(spy.callCount).to.equal(3);
expect(spy.args[0][0]).to.be.instanceOf(ShallowWrapper);
expect(spy.args[0][0].hasClass('bax')).to.equal(true);
expect(spy.args[0][1]).to.equal(0);
expect(spy.args[1][0]).to.be.instanceOf(ShallowWrapper);
expect(spy.args[1][0].hasClass('bar')).to.equal(true);
expect(spy.args[1][1]).to.equal(1);
expect(spy.args[2][0]).to.be.instanceOf(ShallowWrapper);
expect(spy.args[2][0].hasClass('baz')).to.equal(true);
expect(spy.args[2][1]).to.equal(2);
});

it('should return an array with the mapped values', () => {
Expand Down

0 comments on commit b7e46e4

Please sign in to comment.