Rename scaffolderCatalogModule

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-07-08 11:18:50 +02:00
committed by Patrik Oldsberg
parent a3cdfcd078
commit e360c28f22
4 changed files with 47 additions and 5 deletions
@@ -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(),
);
});
});
@@ -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';