Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import { render, screen, fireEvent } from '@testing-library/react';
import React from 'react';
import { MemoryRouter, Routes, Route } from 'react-router-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ErrorBoundaryPage from '../ErrorBoundaryPage';
import ErrorBoundaryPage from './ErrorBoundaryPage';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

Expand Down
22 changes: 22 additions & 0 deletions packages/module/src/ErrorState/ErrorState.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react';
import ErrorState from './ErrorState';
import { render, screen } from '@testing-library/react';

describe('ErrorState component', () => {

it('should render correctly', () => {
render(<ErrorState errorTitle='A Basic Error' errorDescription='The following is an example of a basic error' />);

expect(screen.getByText('A Basic Error')).toBeVisible();
expect(screen.getByText('The following is an example of a basic error')).toBeVisible();
expect(screen.getByText('Go to home page')).toBeVisible();
});

it('should render correctly with default props', () => {
render(<ErrorState />);

expect(screen.getByText('Something went wrong')).toBeVisible();
expect(screen.getByText('Go to home page')).toBeVisible();
});

});
2 changes: 1 addition & 1 deletion packages/module/src/ErrorState/ErrorState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface ErrorStateProps extends Omit<EmptyStateProps, 'children'> {
defaulErrorDescription?: React.ReactNode;
}

const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'Something went wrong', errorDescription, defaulErrorDescription = null, ...props }: ErrorStateProps) => {
const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'Something went wrong', errorDescription, defaulErrorDescription, ...props }: ErrorStateProps) => {
const classes = useStyles();
return (
<EmptyState variant={EmptyStateVariant.large} {...props}>
Expand Down