You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
773 B
34 lines
773 B
2 years ago
|
import React from 'react';
|
||
|
import App from '..';
|
||
|
import mountTest from '../../../tests/shared/mountTest';
|
||
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||
|
import { render } from '../../../tests/utils';
|
||
|
|
||
|
describe('App', () => {
|
||
|
mountTest(App);
|
||
|
rtlTest(App);
|
||
|
|
||
|
it('single', () => {
|
||
|
// Sub page
|
||
|
const MyPage = () => {
|
||
|
const { message } = App.useApp();
|
||
|
React.useEffect(() => {
|
||
|
message.success('Good!');
|
||
|
}, [message]);
|
||
|
|
||
|
return <div>Hello World</div>;
|
||
|
};
|
||
|
|
||
|
// Entry component
|
||
|
const MyApp = () => (
|
||
|
<App>
|
||
|
<MyPage />
|
||
|
</App>
|
||
|
);
|
||
|
|
||
|
const { getByText, container } = render(<MyApp />);
|
||
|
expect(getByText('Hello World')).toBeTruthy();
|
||
|
expect(container.firstChild).toMatchSnapshot();
|
||
|
});
|
||
|
});
|