@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ConfigReader } from '@backstage/core-app-api';
|
||||
import { TableColumn, TableProps } from '@backstage/core-components';
|
||||
import { configApiRef, storageApiRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
@@ -29,7 +28,6 @@ import {
|
||||
import { catalogApiMock } from '@backstage/plugin-catalog-react/testUtils';
|
||||
import {
|
||||
mockApis,
|
||||
MockStorageApi,
|
||||
TestApiProvider,
|
||||
renderInTestApp,
|
||||
} from '@backstage/test-utils';
|
||||
@@ -72,17 +70,15 @@ describe('DefaultApiExplorerPage', () => {
|
||||
}),
|
||||
});
|
||||
|
||||
const configApi = new ConfigReader({
|
||||
organization: {
|
||||
name: 'My Company',
|
||||
},
|
||||
const configApi = mockApis.config({
|
||||
data: { organization: { name: 'My Company' } },
|
||||
});
|
||||
|
||||
const apiDocsConfig = {
|
||||
getApiDefinitionWidget: () => undefined,
|
||||
};
|
||||
|
||||
const storageApi = MockStorageApi.create();
|
||||
const storageApi = mockApis.storage();
|
||||
|
||||
const renderWrapped = (children: React.ReactNode) =>
|
||||
renderInTestApp(
|
||||
|
||||
+5
-6
@@ -19,7 +19,7 @@ import { screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { CookieAuthRefreshProvider } from './CookieAuthRefreshProvider';
|
||||
import {
|
||||
MockStorageApi,
|
||||
mockApis,
|
||||
TestApiProvider,
|
||||
renderInTestApp,
|
||||
} from '@backstage/test-utils';
|
||||
@@ -30,7 +30,6 @@ import {
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
describe('CookieAuthRefreshProvider', () => {
|
||||
const storageApiMock = MockStorageApi.create();
|
||||
const discoveryApiMock = {
|
||||
getBaseUrl: jest
|
||||
.fn()
|
||||
@@ -51,7 +50,7 @@ describe('CookieAuthRefreshProvider', () => {
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[fetchApiRef, fetchApiMock],
|
||||
[storageApiRef, storageApiMock],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[discoveryApiRef, discoveryApiMock],
|
||||
]}
|
||||
>
|
||||
@@ -76,7 +75,7 @@ describe('CookieAuthRefreshProvider', () => {
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[fetchApiRef, fetchApiMock],
|
||||
[storageApiRef, storageApiMock],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[discoveryApiRef, discoveryApiMock],
|
||||
]}
|
||||
>
|
||||
@@ -107,7 +106,7 @@ describe('CookieAuthRefreshProvider', () => {
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[fetchApiRef, fetchApiMock],
|
||||
[storageApiRef, storageApiMock],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[discoveryApiRef, discoveryApiMock],
|
||||
]}
|
||||
>
|
||||
@@ -153,7 +152,7 @@ describe('CookieAuthRefreshProvider', () => {
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[fetchApiRef, fetchApiMock],
|
||||
[storageApiRef, storageApiMock],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[discoveryApiRef, discoveryApiMock],
|
||||
]}
|
||||
>
|
||||
|
||||
@@ -21,7 +21,7 @@ import { MockStarredEntitiesApi, starredEntitiesApiRef } from '../../apis';
|
||||
import { FavoriteEntity } from './FavoriteEntity';
|
||||
import { ComponentEntity } from '@backstage/catalog-model';
|
||||
import {
|
||||
MockStorageApi,
|
||||
mockApis,
|
||||
renderInTestApp,
|
||||
TestApiProvider,
|
||||
} from '@backstage/test-utils';
|
||||
@@ -41,14 +41,12 @@ const entity: ComponentEntity = {
|
||||
},
|
||||
};
|
||||
|
||||
const mockStorage = MockStorageApi.create();
|
||||
|
||||
describe('<FavoriteEntity/>', () => {
|
||||
it('should add to favorites', async () => {
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[storageApiRef, mockStorage],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[starredEntitiesApiRef, new MockStarredEntitiesApi()],
|
||||
]}
|
||||
>
|
||||
@@ -79,7 +77,7 @@ describe('<FavoriteEntity/>', () => {
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[storageApiRef, mockStorage],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[starredEntitiesApiRef, starredEntities],
|
||||
]}
|
||||
>
|
||||
|
||||
@@ -34,7 +34,6 @@ import {
|
||||
} from '@backstage/catalog-client';
|
||||
import { catalogApiRef } from '../../api';
|
||||
import {
|
||||
MockStorageApi,
|
||||
TestApiRegistry,
|
||||
mockApis,
|
||||
renderInTestApp,
|
||||
@@ -79,7 +78,7 @@ const apis = TestApiRegistry.from(
|
||||
[configApiRef, mockConfigApi],
|
||||
[catalogApiRef, mockCatalogApi],
|
||||
[identityApiRef, mockIdentityApi],
|
||||
[storageApiRef, MockStorageApi.create()],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[starredEntitiesApiRef, mockStarredEntitiesApi],
|
||||
);
|
||||
|
||||
@@ -134,19 +133,13 @@ describe('<UserListPicker />', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
mockCatalogApi.getEntityByRef?.mockResolvedValue(mockUser);
|
||||
mockIdentityApi.getBackstageIdentity?.mockResolvedValue({
|
||||
ownershipEntityRefs,
|
||||
type: 'user',
|
||||
userEntityRef: 'user:default/testuser',
|
||||
});
|
||||
|
||||
mockCatalogApi.queryEntities?.mockImplementation(
|
||||
mockQueryEntitiesImplementation,
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('renders filter groups', async () => {
|
||||
|
||||
@@ -23,11 +23,7 @@ import {
|
||||
identityApiRef,
|
||||
storageApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import {
|
||||
MockStorageApi,
|
||||
TestApiProvider,
|
||||
mockApis,
|
||||
} from '@backstage/test-utils';
|
||||
import { TestApiProvider, mockApis } from '@backstage/test-utils';
|
||||
import { act, renderHook, waitFor } from '@testing-library/react';
|
||||
import qs from 'qs';
|
||||
import React, { PropsWithChildren } from 'react';
|
||||
@@ -69,8 +65,6 @@ const entities: Entity[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const mockConfigApi = mockApis.config();
|
||||
|
||||
const ownershipEntityRefs = ['user:default/guest'];
|
||||
|
||||
const mockIdentityApi = mockApis.identity({
|
||||
@@ -104,10 +98,10 @@ const createWrapper =
|
||||
<MemoryRouter initialEntries={[options.location ?? '']}>
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[configApiRef, mockConfigApi],
|
||||
[configApiRef, mockApis.config()],
|
||||
[catalogApiRef, mockCatalogApi],
|
||||
[identityApiRef, mockIdentityApi],
|
||||
[storageApiRef, MockStorageApi.create()],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[starredEntitiesApiRef, new MockStarredEntitiesApi()],
|
||||
[alertApiRef, { post: jest.fn() }],
|
||||
[translationApiRef, MockTranslationApi.create()],
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { MockStorageApi } from '@backstage/test-utils';
|
||||
import { mockApis } from '@backstage/test-utils';
|
||||
import { DefaultStarredEntitiesApi } from './DefaultStarredEntitiesApi';
|
||||
import { performMigrationToTheNewBucket } from './migration';
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('DefaultStarredEntitiesApi', () => {
|
||||
describe('constructor', () => {
|
||||
it('should call migration', () => {
|
||||
const api = new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
});
|
||||
expect(performMigrationToTheNewBucket).toHaveBeenCalledTimes(1);
|
||||
expect(api).toBeDefined();
|
||||
@@ -54,7 +54,7 @@ describe('DefaultStarredEntitiesApi', () => {
|
||||
it('should notify and toggle starred entities', async () => {
|
||||
const entityRef = 'component:default/mock';
|
||||
|
||||
const storageApi = MockStorageApi.create();
|
||||
const storageApi = mockApis.storage();
|
||||
const storageBucket = storageApi.forBucket('starredEntities');
|
||||
const api = new DefaultStarredEntitiesApi({ storageApi });
|
||||
|
||||
@@ -85,7 +85,7 @@ describe('DefaultStarredEntitiesApi', () => {
|
||||
it('should read starred entities from storage', async () => {
|
||||
const entityRef = 'component:default/mock';
|
||||
|
||||
const storageApi = MockStorageApi.create();
|
||||
const storageApi = mockApis.storage();
|
||||
const storageBucket = storageApi.forBucket('starredEntities');
|
||||
storageBucket.set('entityRefs', [entityRef]);
|
||||
const api = new DefaultStarredEntitiesApi({ storageApi });
|
||||
|
||||
@@ -15,18 +15,18 @@
|
||||
*/
|
||||
|
||||
import { StorageApi } from '@backstage/core-plugin-api';
|
||||
import { MockStorageApi } from '@backstage/test-utils';
|
||||
import { mockApis } from '@backstage/test-utils';
|
||||
import { performMigrationToTheNewBucket } from './migration';
|
||||
|
||||
describe('performMigrationToTheNewBucket', () => {
|
||||
let mockStorage: StorageApi;
|
||||
|
||||
beforeEach(() => {
|
||||
mockStorage = MockStorageApi.create();
|
||||
mockStorage = mockApis.storage();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should migrate', async () => {
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { mockBreakpoint } from '@backstage/core-components/testUtils';
|
||||
import {
|
||||
MockStorageApi,
|
||||
TestApiProvider,
|
||||
mockApis,
|
||||
renderInTestApp,
|
||||
@@ -49,7 +48,6 @@ describe('DefaultCatalogPage', () => {
|
||||
});
|
||||
afterEach(() => {
|
||||
window.history.replaceState = origReplaceState;
|
||||
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
@@ -166,7 +164,6 @@ describe('DefaultCatalogPage', () => {
|
||||
ownershipEntityRefs: ['user:default/guest', 'group:default/tools'],
|
||||
displayName: 'Display Name',
|
||||
});
|
||||
const storageApi = MockStorageApi.create();
|
||||
|
||||
const renderWrapped = (children: React.ReactNode) =>
|
||||
renderInTestApp(
|
||||
@@ -174,7 +171,7 @@ describe('DefaultCatalogPage', () => {
|
||||
apis={[
|
||||
[catalogApiRef, catalogApi],
|
||||
[identityApiRef, identityApi],
|
||||
[storageApiRef, storageApi],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[starredEntitiesApiRef, new MockStarredEntitiesApi()],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
]}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { VisitsStorageApi } from './VisitsStorageApi';
|
||||
import { MockStorageApi, mockApis } from '@backstage/test-utils';
|
||||
import { mockApis } from '@backstage/test-utils';
|
||||
import { Visit, VisitsApi } from './VisitsApi';
|
||||
|
||||
describe('VisitsStorageApi.create', () => {
|
||||
@@ -42,7 +42,7 @@ describe('VisitsStorageApi.create', () => {
|
||||
|
||||
it('instantiates', () => {
|
||||
const api = VisitsStorageApi.create({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
identityApi: mockIdentityApi,
|
||||
});
|
||||
expect(api).toBeTruthy();
|
||||
@@ -51,7 +51,7 @@ describe('VisitsStorageApi.create', () => {
|
||||
describe('.save()', () => {
|
||||
it('saves a visit', async () => {
|
||||
const api = VisitsStorageApi.create({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
identityApi: mockIdentityApi,
|
||||
});
|
||||
const visit = {
|
||||
@@ -68,7 +68,7 @@ describe('VisitsStorageApi.create', () => {
|
||||
|
||||
it('can control the number of stored entities', async () => {
|
||||
const api = VisitsStorageApi.create({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
identityApi: mockIdentityApi,
|
||||
limit: 2,
|
||||
});
|
||||
@@ -102,7 +102,7 @@ describe('VisitsStorageApi.create', () => {
|
||||
|
||||
it('correctly bumps the hits from a previous visit', async () => {
|
||||
const api = VisitsStorageApi.create({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
identityApi: mockIdentityApi,
|
||||
});
|
||||
const visit = {
|
||||
@@ -144,7 +144,7 @@ describe('VisitsStorageApi.create', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
api = VisitsStorageApi.create({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
identityApi: mockIdentityApi,
|
||||
});
|
||||
|
||||
|
||||
@@ -13,13 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { fireEvent } from '@testing-library/react';
|
||||
import { CardHeader } from './CardHeader';
|
||||
import { ThemeProvider } from '@material-ui/core/styles';
|
||||
import { lightTheme } from '@backstage/theme';
|
||||
import {
|
||||
MockStorageApi,
|
||||
mockApis,
|
||||
renderInTestApp,
|
||||
TestApiProvider,
|
||||
} from '@backstage/test-utils';
|
||||
@@ -44,7 +45,7 @@ describe('CardHeader', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
]}
|
||||
@@ -75,7 +76,7 @@ describe('CardHeader', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
]}
|
||||
@@ -135,7 +136,7 @@ describe('CardHeader', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
]}
|
||||
@@ -164,7 +165,7 @@ describe('CardHeader', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
]}
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import {
|
||||
mockApis,
|
||||
MockStorageApi,
|
||||
renderInTestApp,
|
||||
TestApiProvider,
|
||||
} from '@backstage/test-utils';
|
||||
@@ -52,7 +51,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -82,7 +81,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -114,7 +113,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -144,7 +143,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -180,7 +179,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -220,7 +219,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -265,7 +264,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -314,7 +313,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -357,7 +356,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -397,7 +396,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -437,7 +436,7 @@ describe('TemplateCard', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
import { catalogApiMock } from '@backstage/plugin-catalog-react/testUtils';
|
||||
import { permissionApiRef } from '@backstage/plugin-permission-react';
|
||||
import {
|
||||
MockStorageApi,
|
||||
renderInTestApp,
|
||||
TestApiProvider,
|
||||
mockApis,
|
||||
@@ -53,7 +52,7 @@ describe('TemplateListPage', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -75,7 +74,7 @@ describe('TemplateListPage', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -98,7 +97,7 @@ describe('TemplateListPage', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -120,7 +119,7 @@ describe('TemplateListPage', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -143,7 +142,7 @@ describe('TemplateListPage', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -165,7 +164,7 @@ describe('TemplateListPage', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
@@ -186,7 +185,7 @@ describe('TemplateListPage', () => {
|
||||
[
|
||||
starredEntitiesApiRef,
|
||||
new DefaultStarredEntitiesApi({
|
||||
storageApi: MockStorageApi.create(),
|
||||
storageApi: mockApis.storage(),
|
||||
}),
|
||||
],
|
||||
[permissionApiRef, mockApis.permission()],
|
||||
|
||||
@@ -14,22 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ApiProvider, ConfigReader } from '@backstage/core-app-api';
|
||||
import {
|
||||
ConfigApi,
|
||||
configApiRef,
|
||||
storageApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { configApiRef, storageApiRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
MockStarredEntitiesApi,
|
||||
catalogApiRef,
|
||||
starredEntitiesApiRef,
|
||||
MockStarredEntitiesApi,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { catalogApiMock } from '@backstage/plugin-catalog-react/testUtils';
|
||||
import {
|
||||
MockStorageApi,
|
||||
renderInTestApp,
|
||||
TestApiRegistry,
|
||||
mockApis,
|
||||
renderInTestApp,
|
||||
} from '@backstage/test-utils';
|
||||
import { screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
@@ -50,18 +46,14 @@ const mockCatalogApi = catalogApiMock({
|
||||
});
|
||||
|
||||
describe('TechDocs Home', () => {
|
||||
const configApi: ConfigApi = new ConfigReader({
|
||||
organization: {
|
||||
name: 'My Company',
|
||||
},
|
||||
const configApi = mockApis.config({
|
||||
data: { organization: { name: 'My Company' } },
|
||||
});
|
||||
|
||||
const storageApi = MockStorageApi.create();
|
||||
|
||||
const apiRegistry = TestApiRegistry.from(
|
||||
[catalogApiRef, mockCatalogApi],
|
||||
[configApiRef, configApi],
|
||||
[storageApiRef, storageApi],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[starredEntitiesApiRef, new MockStarredEntitiesApi()],
|
||||
);
|
||||
|
||||
|
||||
@@ -14,12 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ApiProvider, ConfigReader } from '@backstage/core-app-api';
|
||||
import {
|
||||
ConfigApi,
|
||||
configApiRef,
|
||||
storageApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { configApiRef, storageApiRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
catalogApiRef,
|
||||
starredEntitiesApiRef,
|
||||
@@ -30,9 +26,9 @@ import {
|
||||
catalogApiMock,
|
||||
} from '@backstage/plugin-catalog-react/testUtils';
|
||||
import {
|
||||
MockStorageApi,
|
||||
renderInTestApp,
|
||||
TestApiRegistry,
|
||||
mockApis,
|
||||
} from '@backstage/test-utils';
|
||||
import { screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
@@ -68,21 +64,17 @@ const mockCatalogApi = catalogApiMock({ entities });
|
||||
|
||||
describe('Entity List Docs Grid', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
const configApi: ConfigApi = new ConfigReader({
|
||||
organization: {
|
||||
name: 'My Company',
|
||||
},
|
||||
const configApi = mockApis.config({
|
||||
data: { organization: { name: 'My Company' } },
|
||||
});
|
||||
|
||||
const storageApi = MockStorageApi.create();
|
||||
|
||||
const apiRegistry = TestApiRegistry.from(
|
||||
[catalogApiRef, mockCatalogApi],
|
||||
[configApiRef, configApi],
|
||||
[storageApiRef, storageApi],
|
||||
[storageApiRef, mockApis.storage()],
|
||||
[starredEntitiesApiRef, new MockStarredEntitiesApi()],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user