fix(catalog): make plugin conform to template
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
"@backstage/dev-utils": "^0.1.1-alpha.9",
|
||||
"@backstage/test-utils": "^0.1.1-alpha.9",
|
||||
"@testing-library/jest-dom": "^5.7.0",
|
||||
"@testing-library/react": "^10.2.1",
|
||||
"@testing-library/react": "^9.3.2",
|
||||
"@testing-library/react-hooks": "^3.3.0",
|
||||
"@testing-library/user-event": "^10.2.4",
|
||||
"@types/jest": "^25.2.2",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { render, fireEvent, waitFor, screen } from '@testing-library/react';
|
||||
import { render, fireEvent } from '@testing-library/react';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { CatalogFilter, CatalogFilterGroup } from './CatalogFilter';
|
||||
import { EntityGroup } from '../../data/filters';
|
||||
@@ -124,7 +124,7 @@ describe('Catalog Filter', () => {
|
||||
},
|
||||
];
|
||||
|
||||
render(
|
||||
const { getAllByText } = render(
|
||||
wrapInTestApp(
|
||||
<CatalogFilter {...defaultFilterProps} groups={mockGroups} />,
|
||||
),
|
||||
@@ -134,10 +134,8 @@ describe('Catalog Filter', () => {
|
||||
const matcher = new RegExp(
|
||||
`(${defaultFilterProps.entitiesByFilter[key as EntityGroup].length})`,
|
||||
);
|
||||
await waitFor(() => screen.getAllByText(matcher));
|
||||
screen
|
||||
.getAllByText(matcher)
|
||||
.forEach(el => expect(el).toBeInTheDocument());
|
||||
const items = await getAllByText(matcher);
|
||||
items.forEach(el => expect(el).toBeInTheDocument());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
identityApiRef,
|
||||
} from '@backstage/core';
|
||||
import { MockErrorApi, wrapInTestApp } from '@backstage/test-utils';
|
||||
import { screen, render, fireEvent, waitFor } from '@testing-library/react';
|
||||
import { render, fireEvent } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { catalogApiRef } from '../..';
|
||||
import { CatalogApi } from '../../api/types';
|
||||
@@ -70,7 +70,7 @@ describe('CatalogPage', () => {
|
||||
// related to some theme issues in mui-table
|
||||
// https://github.com/mbrn/material-table/issues/1293
|
||||
it('should render', async () => {
|
||||
render(
|
||||
const { findByText } = render(
|
||||
wrapInTestApp(
|
||||
<ApiProvider
|
||||
apis={ApiRegistry.from([
|
||||
@@ -84,11 +84,12 @@ describe('CatalogPage', () => {
|
||||
</ApiProvider>,
|
||||
),
|
||||
);
|
||||
await waitFor(() => screen.getByText(/All Services \(2\)/));
|
||||
expect(screen.getByText(/All Services \(2\)/)).toBeInTheDocument();
|
||||
|
||||
const items = await findByText(/All Services \(2\)/);
|
||||
expect(items).toBeInTheDocument();
|
||||
});
|
||||
it('should filter by owner', async () => {
|
||||
render(
|
||||
const { findByText, getByText } = render(
|
||||
wrapInTestApp(
|
||||
<ApiProvider
|
||||
apis={ApiRegistry.from([
|
||||
@@ -102,8 +103,8 @@ describe('CatalogPage', () => {
|
||||
</ApiProvider>,
|
||||
),
|
||||
);
|
||||
fireEvent.click(screen.getByText(/Owned/));
|
||||
await waitFor(() => screen.getByText(/Owned \(1\)/));
|
||||
expect(screen.getByText(/Owned \(1\)/)).toBeInTheDocument();
|
||||
fireEvent.click(getByText(/Owned/));
|
||||
const items = await findByText(/Owned \(1\)/);
|
||||
expect(items).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user