Add router tests for the new scaffolder context menu
Signed-off-by: Min Kim <minkimcello@gmail.com>
This commit is contained in:
@@ -135,4 +135,54 @@ describe('TemplateListPage', () => {
|
||||
|
||||
expect(getByText('Tags')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe('scaffolder page context menu', () => {
|
||||
it('should render if context menu props are not set to false', async () => {
|
||||
const { queryByTestId } = await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[catalogApiRef, mockCatalogApi],
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, {}],
|
||||
]}
|
||||
>
|
||||
<TemplateListPage />
|
||||
</TestApiProvider>,
|
||||
{ mountedRoutes: { '/': rootRouteRef } },
|
||||
);
|
||||
expect(queryByTestId('menu-button')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render if context menu props are set to false', async () => {
|
||||
const { queryByTestId } = await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[catalogApiRef, mockCatalogApi],
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, {}],
|
||||
]}
|
||||
>
|
||||
<TemplateListPage
|
||||
contextMenu={{
|
||||
editor: false,
|
||||
actions: false,
|
||||
tasks: false,
|
||||
}}
|
||||
/>
|
||||
</TestApiProvider>,
|
||||
{ mountedRoutes: { '/': rootRouteRef } },
|
||||
);
|
||||
expect(queryByTestId('menu-button')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user