Rename scaffolderCatalogModule
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
committed by
Patrik Oldsberg
parent
a3cdfcd078
commit
e360c28f22
@@ -16,7 +16,7 @@
|
||||
|
||||
import { createBackend } from '@backstage/backend-app-api';
|
||||
import { catalogPlugin } from '@backstage/plugin-catalog-backend';
|
||||
import { scaffolderCatalogExtension } from '@backstage/plugin-scaffolder-backend';
|
||||
import { scaffolderCatalogModule } from '@backstage/plugin-scaffolder-backend';
|
||||
|
||||
// export const appPlugin = createBackendPlugin({
|
||||
// id: 'app',
|
||||
@@ -47,5 +47,5 @@ const backend = createBackend({
|
||||
});
|
||||
|
||||
backend.add(catalogPlugin({}));
|
||||
backend.add(scaffolderCatalogExtension({}));
|
||||
backend.add(scaffolderCatalogModule({}));
|
||||
backend.start();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BackendInitRegistry } from '@backstage/backend-plugin-api';
|
||||
import { ScaffolderEntitiesProcessor } from '../processor';
|
||||
import { scaffolderCatalogModule } from './ScaffolderCatalogModule';
|
||||
|
||||
describe('ScaffolderCatalogModule', () => {
|
||||
it('should register the extension point', () => {
|
||||
// TODO(jhaals): clean this up and add test helpers for backend system.
|
||||
const ext = scaffolderCatalogModule({});
|
||||
expect(ext.id).toBe('catalog.scaffolder.module');
|
||||
const registry: jest.Mocked<BackendInitRegistry> = {
|
||||
registerInit: jest.fn(),
|
||||
} as any;
|
||||
ext.register(registry);
|
||||
|
||||
const extensionPoint = {
|
||||
addProcessor: jest.fn(),
|
||||
};
|
||||
|
||||
registry.registerInit.mock.calls[0][0].init({
|
||||
catalogProcessingExtensionPoint: extensionPoint,
|
||||
});
|
||||
expect(extensionPoint.addProcessor).toHaveBeenCalledWith(
|
||||
new ScaffolderEntitiesProcessor(),
|
||||
);
|
||||
});
|
||||
});
|
||||
+2
-2
@@ -21,8 +21,8 @@ import { ScaffolderEntitiesProcessor } from '../processor';
|
||||
* @alpha
|
||||
* Registers the ScaffolderEntitiesProcessor with the catalog processing extension point.
|
||||
*/
|
||||
export const scaffolderCatalogExtension = createBackendModule({
|
||||
moduleId: 'scaffolder.extention',
|
||||
export const scaffolderCatalogModule = createBackendModule({
|
||||
moduleId: 'scaffolder.module',
|
||||
pluginId: 'catalog',
|
||||
register(env) {
|
||||
env.registerInit({
|
||||
@@ -13,4 +13,4 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { scaffolderCatalogExtension } from './ScaffolderCatalogExtension';
|
||||
export { scaffolderCatalogModule } from './ScaffolderCatalogModule';
|
||||
|
||||
Reference in New Issue
Block a user