Skip to content

Commit

Permalink
Remove Shallow Renderer Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Oct 13, 2022
1 parent a8c16a0 commit cca955a
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 3,655 deletions.
43 changes: 0 additions & 43 deletions packages/react-dom/src/__tests__/ReactTestUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

'use strict';

import ReactShallowRenderer from 'react-test-renderer/shallow';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactDOMServer from 'react-dom/server';
Expand Down Expand Up @@ -383,48 +382,6 @@ describe('ReactTestUtils', () => {
);
});

it('should throw when attempting to use a React element', () => {
class SomeComponent extends React.Component {
render() {
return <div onClick={this.props.handleClick}>hello, world.</div>;
}
}

const handler = jest.fn().mockName('spy');
const shallowRenderer = ReactShallowRenderer.createRenderer();
const result = shallowRenderer.render(
<SomeComponent handleClick={handler} />,
);

expect(() => ReactTestUtils.Simulate.click(result)).toThrowError(
'TestUtils.Simulate expected a DOM node as the first argument but received ' +
'a React element. Pass the DOM node you wish to simulate the event on instead. ' +
'Note that TestUtils.Simulate will not work if you are using shallow rendering.',
);
expect(handler).not.toHaveBeenCalled();
});

it('should throw when attempting to use a component instance', () => {
class SomeComponent extends React.Component {
render() {
return <div onClick={this.props.handleClick}>hello, world.</div>;
}
}

const handler = jest.fn().mockName('spy');
const container = document.createElement('div');
const instance = ReactDOM.render(
<SomeComponent handleClick={handler} />,
container,
);

expect(() => ReactTestUtils.Simulate.click(instance)).toThrowError(
'TestUtils.Simulate expected a DOM node as the first argument but received ' +
'a component instance. Pass the DOM node you wish to simulate the event on instead.',
);
expect(handler).not.toHaveBeenCalled();
});

it('should not warn when used with extra properties', () => {
const CLIENT_X = 100;

Expand Down
Loading

0 comments on commit cca955a

Please sign in to comment.