update test case to support custom error page
Signed-off-by: Stephen Glass <stephen@stephen.glass>
This commit is contained in:
+12
-13
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user