update test case to support custom error page

Signed-off-by: Stephen Glass <stephen@stephen.glass>
This commit is contained in:
Stephen Glass
2025-01-25 16:05:37 -05:00
committed by blam
parent eb3d91a351
commit 681ac9d2e6
@@ -126,20 +126,19 @@ describe('<TechDocsReaderPageContent />', () => {
useTechDocsReaderDom.mockReturnValue(document.createElement('html'));
useReaderState.mockReturnValue({ state: 'cached' });
const rendered = await renderInTestApp(
<Wrapper>
<TechDocsReaderPageContent withSearch={false} />
</Wrapper>,
);
await expect(
renderInTestApp(
<Wrapper>
<TechDocsReaderPageContent withSearch={false} />
</Wrapper>,
),
).rejects.toThrow('Reached NotFound Page');
await waitFor(() => {
expect(
rendered.queryByTestId('techdocs-native-shadowroot'),
).not.toBeInTheDocument();
expect(
rendered.getByText('ERROR 404: PAGE NOT FOUND'),
).toBeInTheDocument();
});
// Check the global document for the absence of the shadow root
const shadowRoot = document.querySelector(
'[data-testid="techdocs-native-shadowroot"]',
);
expect(shadowRoot).not.toBeInTheDocument();
});
it('should render 404 if there is no dom and reader state is not found', async () => {