updated tests

Signed-off-by: Alex Rybchenko <arybchenko@box.com>
This commit is contained in:
Alex Rybchenko
2021-10-04 19:01:54 +02:00
committed by blam
parent 590062d521
commit 7c5351791e
7 changed files with 68 additions and 1 deletions
@@ -19,6 +19,7 @@ import {
CatalogApi,
catalogApiRef,
EntityProvider,
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
@@ -71,6 +72,11 @@ describe('<ConsumedApisCard />', () => {
<ConsumedApisCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
expect(getByText(/Consumed APIs/i)).toBeInTheDocument();
@@ -116,6 +122,11 @@ describe('<ConsumedApisCard />', () => {
<ConsumedApisCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
await waitFor(() => {
@@ -19,6 +19,7 @@ import {
CatalogApi,
catalogApiRef,
EntityProvider,
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
@@ -71,6 +72,11 @@ describe('<HasApisCard />', () => {
<HasApisCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
expect(getByText('APIs')).toBeInTheDocument();
@@ -116,6 +122,11 @@ describe('<HasApisCard />', () => {
<HasApisCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
await waitFor(() => {
@@ -19,6 +19,7 @@ import {
CatalogApi,
catalogApiRef,
EntityProvider,
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
@@ -71,6 +72,11 @@ describe('<ProvidedApisCard />', () => {
<ProvidedApisCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
expect(getByText(/Provided APIs/i)).toBeInTheDocument();
@@ -116,6 +122,11 @@ describe('<ProvidedApisCard />', () => {
<ProvidedApisCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
await waitFor(() => {
@@ -19,6 +19,7 @@ import {
CatalogApi,
catalogApiRef,
EntityProvider,
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
@@ -70,6 +71,11 @@ describe('<ConsumingComponentsCard />', () => {
<ConsumingComponentsCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
expect(getByText('Consumers')).toBeInTheDocument();
@@ -121,6 +127,11 @@ describe('<ConsumingComponentsCard />', () => {
<ConsumingComponentsCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
await waitFor(() => {
@@ -19,6 +19,7 @@ import {
CatalogApi,
catalogApiRef,
EntityProvider,
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
@@ -70,6 +71,11 @@ describe('<ProvidingComponentsCard />', () => {
<ProvidingComponentsCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
expect(getByText('Providers')).toBeInTheDocument();
@@ -121,6 +127,11 @@ describe('<ProvidingComponentsCard />', () => {
<ProvidingComponentsCard />
</EntityProvider>
</Wrapper>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
await waitFor(() => {
@@ -15,7 +15,10 @@
*/
import { UserEntity } from '@backstage/catalog-model';
import { EntityProvider } from '@backstage/plugin-catalog-react';
import {
EntityProvider,
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import { renderWithEffects, wrapInTestApp } from '@backstage/test-utils';
import React from 'react';
import { UserProfileCard } from './UserProfileCard';
@@ -53,6 +56,11 @@ describe('UserSummary Test', () => {
<EntityProvider entity={userEntity}>
<UserProfileCard entity={userEntity} variant="gridItem" />
</EntityProvider>,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
),
);
@@ -19,6 +19,7 @@ import { wrapInTestApp } from '@backstage/test-utils';
import { configApiRef } from '@backstage/core-plugin-api';
import { DocsTable } from './DocsTable';
import { rootDocsRouteRef } from '../../routes';
import { entityRouteRef } from '@backstage/plugin-catalog-react';
// Hacky way to mock a specific boolean config value.
const getOptionalBooleanMock = jest.fn().mockReturnValue(false);
@@ -94,6 +95,7 @@ describe('DocsTable test', () => {
{
mountedRoutes: {
'/docs/:namespace/:kind/:name/*': rootDocsRouteRef,
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
),
@@ -144,6 +146,7 @@ describe('DocsTable test', () => {
{
mountedRoutes: {
'/techdocs/:namespace/:kind/:name/*': rootDocsRouteRef,
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
),
@@ -163,6 +166,7 @@ describe('DocsTable test', () => {
wrapInTestApp(<DocsTable entities={[]} />, {
mountedRoutes: {
'/docs/:namespace/:kind/:name/*': rootDocsRouteRef,
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
}),
);