Using catalogApiMock from @backstage/plugin-catalog-react/testUtils.
Signed-off-by: Owen Shartle <timeloveinvent+github@gmail.com>
This commit is contained in:
@@ -44,6 +44,7 @@ import {
|
||||
entityPresentationApiRef,
|
||||
entityRouteRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { catalogApiMock } from '@backstage/plugin-catalog-react/testUtils';
|
||||
import { searchApiRef } from '@backstage/plugin-search-react';
|
||||
import { scmIntegrationsApiRef } from '@backstage/integration-react';
|
||||
|
||||
@@ -236,12 +237,15 @@ export class TechDocsAddonTester {
|
||||
}),
|
||||
};
|
||||
|
||||
const catalogApi = {
|
||||
getEntityByRef: jest.fn().mockResolvedValue({
|
||||
kind: 'Component',
|
||||
metadata: { namespace: 'default', name: 'docs' },
|
||||
}),
|
||||
};
|
||||
const catalogApi = catalogApiMock({
|
||||
entities: [
|
||||
{
|
||||
apiVersion: 'backstage.io/v1alpha1',
|
||||
kind: 'Component',
|
||||
metadata: { namespace: 'default', name: 'docs' },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const apis: TechdocsAddonTesterApis<any[]> = [
|
||||
[fetchApiRef, fetchApi],
|
||||
|
||||
+2
-3
@@ -27,6 +27,7 @@ import {
|
||||
renderInTestApp,
|
||||
TestApiProvider,
|
||||
} from '@backstage/test-utils';
|
||||
import { catalogApiMock as catalogApiMockFactory } from '@backstage/plugin-catalog-react/testUtils';
|
||||
|
||||
import { techdocsApiRef, techdocsStorageApiRef } from '../../../api';
|
||||
|
||||
@@ -96,9 +97,7 @@ const entityPresentationApiMock: jest.Mocked<
|
||||
}),
|
||||
};
|
||||
|
||||
const catalogApiMock = {
|
||||
getEntityByRef: jest.fn().mockResolvedValue(mockEntityMetadata),
|
||||
};
|
||||
const catalogApiMock = catalogApiMockFactory.mock();
|
||||
|
||||
const fetchApiMock = {
|
||||
fetch: jest.fn().mockResolvedValue({
|
||||
|
||||
Reference in New Issue
Block a user