2019-08-26 22:53:20 +08:00
|
|
|
import React from 'react';
|
2022-04-29 19:56:15 +08:00
|
|
|
import { render } from '../utils';
|
2019-08-26 22:53:20 +08:00
|
|
|
|
2023-06-07 21:59:21 +08:00
|
|
|
// eslint-disable-next-line jest/no-export
|
2020-04-13 13:36:23 +08:00
|
|
|
export default function mountTest(Component: React.ComponentType) {
|
2019-08-26 22:53:20 +08:00
|
|
|
describe(`mount and unmount`, () => {
|
|
|
|
// https://github.com/ant-design/ant-design/pull/18441
|
|
|
|
it(`component could be updated and unmounted without errors`, () => {
|
2022-04-29 19:56:15 +08:00
|
|
|
const { unmount, rerender } = render(<Component />);
|
2019-08-26 22:53:20 +08:00
|
|
|
expect(() => {
|
2022-04-29 19:56:15 +08:00
|
|
|
rerender(<Component />);
|
|
|
|
unmount();
|
2019-08-26 22:53:20 +08:00
|
|
|
}).not.toThrow();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|