update type from JSX.Element or string to ReactNode + add test for string based prop

Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2022-02-07 14:33:12 +01:00
parent 0912186d16
commit 4922f11fe3
2 changed files with 17 additions and 1 deletions
@@ -32,6 +32,22 @@ describe('<ErrorPage/>', () => {
expect(getByTestId('go-back-link')).toBeInTheDocument();
});
it('should render with additional information of type string', async () => {
const { getByText } = await renderInTestApp(
<ErrorPage
status="404"
statusMessage="PAGE NOT FOUND"
additionalInfo="This is a string based additional information"
/>,
);
expect(
getByText(/looks like someone dropped the mic!/i),
).toBeInTheDocument();
expect(
getByText(/This is a string based additional information/i),
).toBeInTheDocument();
});
it('should render with additional information including link', async () => {
const { getByText } = await renderInTestApp(
<ErrorPage
@@ -27,7 +27,7 @@ import { MicDrop } from './MicDrop';
interface IErrorPageProps {
status: string;
statusMessage: string;
additionalInfo?: string | JSX.Element;
additionalInfo?: React.ReactNode;
supportUrl?: string;
}