Skip to content

Commit

Permalink
Test error messages for getDOMNode
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Campos committed Dec 22, 2016
1 parent cb1daad commit f7d302c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/ReactWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3399,7 +3399,10 @@ describeWithDOM('mount', () => {

it('should throw when wrapping multiple elements', () => {
const wrapper = mount(<Test />).find('span');
expect(() => wrapper.getDOMNode()).to.throw(Error);
expect(() => wrapper.getDOMNode()).to.throw(
Error,
'Method “getDOMNode” is only meant to be run on a single node. 2 found instead.',
);
});

describeIf(!REACT013, 'stateless components', () => {
Expand All @@ -3424,7 +3427,10 @@ describeWithDOM('mount', () => {

it('should throw when wrapping multiple elements', () => {
const wrapper = mount(<SFC />).find('span');
expect(() => wrapper.getDOMNode()).to.throw(Error);
expect(() => wrapper.getDOMNode()).to.throw(
Error,
'Method “getDOMNode” is only meant to be run on a single node. 2 found instead.',
);
});
});
});
Expand Down

0 comments on commit f7d302c

Please sign in to comment.