diff --git a/packages/frontend-plugin-api/src/components/ExtensionBoundary.test.tsx b/packages/frontend-plugin-api/src/components/ExtensionBoundary.test.tsx
index 1f12f127e8..403d591db1 100644
--- a/packages/frontend-plugin-api/src/components/ExtensionBoundary.test.tsx
+++ b/packages/frontend-plugin-api/src/components/ExtensionBoundary.test.tsx
@@ -30,24 +30,26 @@ import {
} from '@backstage/core-plugin-api';
import { createRouteRef } from '../routing';
import { createExtensionTester } from '@backstage/frontend-test-utils';
-import { createApiExtension } from '../extensions';
+import { ApiBlueprint } from '../blueprints';
const wrapInBoundaryExtension = (element?: JSX.Element) => {
const routeRef = createRouteRef();
return createExtension({
name: 'test',
attachTo: { id: 'app/routes', input: 'routes' },
- output: {
- element: coreExtensionData.reactElement,
- path: coreExtensionData.routePath,
- routeRef: coreExtensionData.routeRef.optional(),
- },
+ output: [
+ coreExtensionData.reactElement,
+ coreExtensionData.routePath,
+ coreExtensionData.routeRef.optional(),
+ ],
factory({ node }) {
- return {
- routeRef,
- path: '/',
- element: {element},
- };
+ return [
+ coreExtensionData.reactElement(
+ {element},
+ ),
+ coreExtensionData.routePath('/'),
+ coreExtensionData.routeRef(routeRef),
+ ];
},
});
};
@@ -134,8 +136,11 @@ describe('ExtensionBoundary', () => {
await act(async () => {
createExtensionTester(wrapInBoundaryExtension())
.add(
- createApiExtension({
- factory: createApiFactory(analyticsApiRef, analyticsApiMock),
+ ApiBlueprint.make({
+ namespace: analyticsApiRef.id,
+ params: {
+ factory: createApiFactory(analyticsApiRef, analyticsApiMock),
+ },
}),
)
.render();
diff --git a/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx b/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx
index 73220419b7..86953df675 100644
--- a/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx
+++ b/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx
@@ -41,8 +41,8 @@ describe('createExtensionTester', () => {
const defaultDefinition = {
namespace: 'test',
attachTo: { id: 'ignored', input: 'ignored' },
- output: { element: coreExtensionData.reactElement },
- factory: () => ({ element:
test
}),
+ output: [coreExtensionData.reactElement],
+ factory: () => [coreExtensionData.reactElement(test
)],
};
it('should render a simple extension', async () => {
@@ -77,23 +77,23 @@ describe('createExtensionTester', () => {
it('should render multiple extensions', async () => {
const indexPageExtension = createExtension({
...defaultDefinition,
- factory: () => ({
- element: (
+ factory: () => [
+ coreExtensionData.reactElement(
Index page See details
-
+ ,
),
- }),
+ ],
});
const detailsPageExtension = createExtension({
...defaultDefinition,
name: 'details',
attachTo: { id: 'app/routes', input: 'routes' },
- output: {
- path: coreExtensionData.routePath,
- element: coreExtensionData.reactElement,
- },
- factory: () => ({ path: '/details', element: Details page
}),
+ output: [coreExtensionData.routePath, coreExtensionData.reactElement],
+ factory: () => [
+ coreExtensionData.routePath('/details'),
+ coreExtensionData.reactElement(Details page
),
+ ],
});
const tester = createExtensionTester(indexPageExtension);
@@ -112,9 +112,11 @@ describe('createExtensionTester', () => {
it('should accepts a custom config', async () => {
const indexPageExtension = createExtension({
...defaultDefinition,
- configSchema: createSchemaFromZod(z =>
- z.object({ title: z.string().optional() }),
- ),
+ config: {
+ schema: {
+ title: z => z.string().optional(),
+ },
+ },
factory: ({ config }) => {
const Component = () => {
const configApi = useApi(configApiRef);
@@ -127,9 +129,8 @@ describe('createExtensionTester', () => {
);
};
- return {
- element: ,
- };
+
+ return [coreExtensionData.reactElement()];
},
});
@@ -137,17 +138,18 @@ describe('createExtensionTester', () => {
...defaultDefinition,
name: 'details',
attachTo: { id: 'app/routes', input: 'routes' },
- configSchema: createSchemaFromZod(z =>
- z.object({ title: z.string().optional() }),
- ),
- output: {
- path: coreExtensionData.routePath,
- element: coreExtensionData.reactElement,
+ config: {
+ schema: {
+ title: z => z.string().optional(),
+ },
},
- factory: ({ config }) => ({
- path: '/details',
- element: {config.title ?? 'Details page'}
,
- }),
+ output: [coreExtensionData.routePath, coreExtensionData.reactElement],
+ factory: ({ config }) => [
+ coreExtensionData.routePath('/details'),
+ coreExtensionData.reactElement(
+ {config.title ?? 'Details page'}
,
+ ),
+ ],
});
const tester = createExtensionTester(indexPageExtension, {
@@ -209,9 +211,7 @@ describe('createExtensionTester', () => {
);
};
- return {
- element: ,
- };
+ return [coreExtensionData.reactElement()];
},
});
@@ -254,16 +254,16 @@ describe('createExtensionTester', () => {
namespace: 'test',
name: 'e1',
attachTo: { id: 'ignored', input: 'ignored' },
- output: { text: stringDataRef },
- factory: () => ({ text: 'test-text' }),
+ output: [stringDataRef],
+ factory: () => [stringDataRef('test-text')],
});
const extension2 = createExtension({
namespace: 'test',
name: 'e2',
attachTo: { id: 'ignored', input: 'ignored' },
- output: { text: stringDataRef },
- factory: () => ({ text: 'test-text' }),
+ output: [stringDataRef],
+ factory: () => [stringDataRef('test-text')],
});
const tester = createExtensionTester(extension);
@@ -278,16 +278,16 @@ describe('createExtensionTester', () => {
namespace: 'test',
name: 'e1',
attachTo: { id: 'ignored', input: 'ignored' },
- output: { text: stringDataRef },
- factory: () => ({ text: 'test-text' }),
+ output: [stringDataRef],
+ factory: () => [stringDataRef('test-text')],
});
const extension2 = createExtension({
namespace: 'test',
name: 'e2',
attachTo: { id: 'ignored', input: 'ignored' },
- output: { text: stringDataRef },
- factory: () => ({ text: 'test-text' }),
+ output: [stringDataRef],
+ factory: () => [stringDataRef('test-text')],
});
const tester = createExtensionTester(extension).add(extension2);
@@ -377,26 +377,21 @@ describe('createExtensionTester', () => {
namespace: 'test',
name: 'e1',
attachTo: { id: 'ignored', input: 'ignored' },
- output: { text: stringDataRef },
+ output: [stringDataRef],
inputs: {
- input: createExtensionInput(
- {
- output: stringDataRef,
- },
- { singleton: true },
- ),
+ input: createExtensionInput([stringDataRef], { singleton: true }),
},
- factory: ({ inputs }) => ({
- text: `nest-${inputs.input.output.output}`,
- }),
+ factory: ({ inputs }) => [
+ stringDataRef(`nest-${inputs.input.get(stringDataRef)}`),
+ ],
});
const extension2 = createExtension({
namespace: 'test',
name: 'e2',
attachTo: { id: 'test/e1', input: 'blob' },
- output: { text: stringDataRef },
- factory: () => ({ text: 'test-text' }),
+ output: [stringDataRef],
+ factory: () => [stringDataRef('test-text')],
});
const tester = createExtensionTester(extension).add(extension2);
@@ -418,18 +413,13 @@ describe('createExtensionTester', () => {
namespace: 'test',
name: 'e1',
attachTo: { id: 'ignored', input: 'ignored' },
- output: { text: stringDataRef },
+ output: [stringDataRef],
inputs: {
- input: createExtensionInput(
- {
- output: stringDataRef,
- },
- { singleton: true },
- ),
+ input: createExtensionInput([stringDataRef], { singleton: true }),
},
- factory: ({ inputs }) => ({
- text: `nest-${inputs.input.output.output}`,
- }),
+ factory: ({ inputs }) => [
+ stringDataRef(`nest-${inputs.input.get(stringDataRef)}`),
+ ],
});
const tester = createExtensionTester(extension, {
diff --git a/packages/frontend-test-utils/src/app/renderInTestApp.tsx b/packages/frontend-test-utils/src/app/renderInTestApp.tsx
index dd03cdd2a2..b37a7c2a8d 100644
--- a/packages/frontend-test-utils/src/app/renderInTestApp.tsx
+++ b/packages/frontend-test-utils/src/app/renderInTestApp.tsx
@@ -152,14 +152,16 @@ export function renderInTestApp(
kind: 'test-route',
name: path,
attachTo: { id: 'app/root', input: 'elements' },
- output: {
- element: coreExtensionData.reactElement,
- path: coreExtensionData.routePath,
- routeRef: coreExtensionData.routeRef,
- },
- factory() {
- return { element: , path, routeRef };
- },
+ output: [
+ coreExtensionData.reactElement,
+ coreExtensionData.routePath,
+ coreExtensionData.routeRef,
+ ],
+ factory: () => [
+ coreExtensionData.reactElement(),
+ coreExtensionData.routePath(path),
+ coreExtensionData.routeRef(routeRef),
+ ],
}),
);
}