2022-06-23 06:32:18 +00:00
|
|
|
import { renderWithQueryClient } from '@/react-tools/test-utils';
|
2021-12-30 15:46:12 +00:00
|
|
|
|
|
|
|
import { HeaderContainer } from './HeaderContainer';
|
|
|
|
import { HeaderContent } from './HeaderContent';
|
|
|
|
|
|
|
|
test('should not render without a wrapping HeaderContainer', async () => {
|
2022-03-08 12:14:23 +00:00
|
|
|
const consoleErrorFn = jest
|
|
|
|
.spyOn(console, 'error')
|
|
|
|
.mockImplementation(() => jest.fn());
|
|
|
|
|
2021-12-30 15:46:12 +00:00
|
|
|
function renderComponent() {
|
2022-06-23 06:32:18 +00:00
|
|
|
return renderWithQueryClient(<HeaderContent />);
|
2021-12-30 15:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
expect(renderComponent).toThrowErrorMatchingSnapshot();
|
2022-03-08 12:14:23 +00:00
|
|
|
|
|
|
|
consoleErrorFn.mockRestore();
|
2021-12-30 15:46:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('should display a HeaderContent', async () => {
|
|
|
|
const content = 'content';
|
|
|
|
|
2022-06-23 06:32:18 +00:00
|
|
|
const { queryByText } = renderWithQueryClient(
|
|
|
|
<HeaderContainer>
|
|
|
|
<HeaderContent>{content}</HeaderContent>
|
|
|
|
</HeaderContainer>
|
2021-12-30 15:46:12 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
const contentElement = queryByText(content);
|
|
|
|
expect(contentElement).toBeVisible();
|
|
|
|
});
|