feat(TechDocs): update <TechDocsCustomHome /> to support the new <DocsTable /> component

Signed-off-by: Yingbai He <yingbai.he@mycase.com>
This commit is contained in:
Yingbai He
2024-11-15 16:49:09 -07:00
parent 9610583759
commit 18f8ff410a
2 changed files with 13 additions and 3 deletions
@@ -14,7 +14,11 @@
* limitations under the License.
*/
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import {
catalogApiRef,
starredEntitiesApiRef,
MockStarredEntitiesApi,
} from '@backstage/plugin-catalog-react';
import { catalogApiMock } from '@backstage/plugin-catalog-react/testUtils';
import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils';
import { screen } from '@testing-library/react';
@@ -37,7 +41,10 @@ const mockCatalogApi = catalogApiMock({
});
describe('TechDocsCustomHome', () => {
const apiRegistry = TestApiRegistry.from([catalogApiRef, mockCatalogApi]);
const apiRegistry = TestApiRegistry.from(
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, new MockStarredEntitiesApi()],
);
it('should render a TechDocs home page', async () => {
const tabsConfig = [
@@ -23,6 +23,7 @@ import {
catalogApiRef,
CatalogApi,
useEntityOwnership,
EntityListProvider,
} from '@backstage/plugin-catalog-react';
import { Entity } from '@backstage/catalog-model';
import { DocsTable } from './Tables';
@@ -127,7 +128,9 @@ const CustomPanel = ({
) : null}
</ContentHeader>
<div className={classes.panelContainer}>
<Panel data-testid="techdocs-custom-panel" entities={shownEntities} />
<EntityListProvider>
<Panel data-testid="techdocs-custom-panel" entities={shownEntities} />
</EntityListProvider>
</div>
</>
);