Skip to content

Commit

Permalink
[Tests] use .to.equal for primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Mar 11, 2019
1 parent f457671 commit b467ea6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,7 @@ describeWithDOM('mount', () => {
expect(wrapper.state()).to.eql({ id: 'bar' });
expect(this).to.equal(wrapper.instance());
expect(this.state).to.eql({ id: 'bar' });
expect(wrapper.find('div').prop('className')).to.eql('bar');
expect(wrapper.find('div').prop('className')).to.equal('bar');
expect(args).to.eql(CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED ? [undefined] : []);
resolve();
});
Expand Down Expand Up @@ -3401,11 +3401,11 @@ describeWithDOM('mount', () => {
it('sets the state of the parent', () => {
const wrapper = mount(<Parent />);

expect(wrapper.text().trim()).to.eql('1 - a');
expect(wrapper.text().trim()).to.equal('1 - a');

return new Promise((resolve) => {
wrapper.setState({ childProp: 2 }, () => {
expect(wrapper.text().trim()).to.eql('2 - a');
expect(wrapper.text().trim()).to.equal('2 - a');
resolve();
});
});
Expand All @@ -3414,11 +3414,11 @@ describeWithDOM('mount', () => {
it('sets the state of the child', () => {
const wrapper = mount(<Parent />);

expect(wrapper.text().trim()).to.eql('1 - a');
expect(wrapper.text().trim()).to.equal('1 - a');

return new Promise((resolve) => {
wrapper.find(Child).setState({ state: 'b' }, () => {
expect(wrapper.text().trim()).to.eql('1 - b');
expect(wrapper.text().trim()).to.equal('1 - b');
resolve();
});
});
Expand All @@ -3431,11 +3431,11 @@ describeWithDOM('mount', () => {

const wrapper = mount(<SFC />);

expect(wrapper.text().trim()).to.eql('1 - a');
expect(wrapper.text().trim()).to.equal('1 - a');

return new Promise((resolve) => {
wrapper.find(Child).setState({ state: 'b' }, () => {
expect(wrapper.text().trim()).to.eql('1 - b');
expect(wrapper.text().trim()).to.equal('1 - b');
resolve();
});
});
Expand Down
8 changes: 4 additions & 4 deletions packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3095,7 +3095,7 @@ describe('shallow', () => {
expect(wrapper.state()).to.eql({ id: 'bar' });
expect(this).to.equal(wrapper.instance());
expect(this.state).to.eql({ id: 'bar' });
expect(wrapper.find('div').prop('className')).to.eql('bar');
expect(wrapper.find('div').prop('className')).to.equal('bar');
expect(args).to.eql(CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED ? [undefined] : []);
resolve();
});
Expand Down Expand Up @@ -3375,11 +3375,11 @@ describe('shallow', () => {
it('sets the state of the parent', () => {
const wrapper = shallow(<Parent />);

expect(wrapper.debug()).to.eql('<Child prop={1} />');
expect(wrapper.debug()).to.equal('<Child prop={1} />');

return new Promise((resolve) => {
wrapper.setState({ childProp: 2 }, () => {
expect(wrapper.debug()).to.eql('<Child prop={2} />');
expect(wrapper.debug()).to.equal('<Child prop={2} />');
resolve();
});
});
Expand All @@ -3388,7 +3388,7 @@ describe('shallow', () => {
it('can not set the state of the child', () => {
const wrapper = shallow(<Parent />);

expect(wrapper.debug()).to.eql('<Child prop={1} />');
expect(wrapper.debug()).to.equal('<Child prop={1} />');

expect(() => wrapper.find(Child).setState({ state: 'b' })).to.throw(
Error,
Expand Down

0 comments on commit b467ea6

Please sign in to comment.