Skip to content

Commit d9e0d48

Browse files
committed
Added inline note to createReactClassIntegration-test about why lifecycles hooks not migrated
1 parent f0e6f62 commit d9e0d48

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/react/src/__tests__/createReactClassIntegration-test.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,25 @@ describe('create-react-class-integration', () => {
401401

402402
const container = document.createElement('div');
403403

404-
expect(() => ReactDOM.render(<Component />, container)).toWarnDev(
404+
// Note: The below lifecycle warnings are unavoidable for now,
405+
// Until create-react-class recognizes the unsafe_* methods.
406+
// (If we try to use them before them, it will error because
407+
// we are defining the same method twice.)
408+
expect(() => ReactDOM.render(<Component />, container)).toWarnDev([
405409
'Warning: MyComponent: isMounted is deprecated. Instead, make sure to ' +
406410
'clean up subscriptions and pending requests in componentWillUnmount ' +
407411
'to prevent memory leaks.',
412+
'Warning: MyComponent: componentWillMount() is deprecated and will be ' +
413+
'removed in the next major version. Please use ' +
414+
'unsafe_componentWillMount() instead.',
415+
]);
416+
417+
expect(() => ReactDOM.render(<Component />, container)).toWarnDev(
418+
'Warning: MyComponent: componentWillUpdate() is deprecated and will be ' +
419+
'removed in the next major version. Please use ' +
420+
'unsafe_componentWillUpdate() instead.'
408421
);
409422

410-
ReactDOM.render(<Component />, container);
411423
ReactDOM.unmountComponentAtNode(container);
412424
instance.log('after unmount');
413425
expect(ops).toEqual([

0 commit comments

Comments
 (0)