From 1ac573b4f3e4f8ffa34ff0d81cb3bfd9160d74f7 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 3 Sep 2024 07:59:02 +0200 Subject: [PATCH] chore: smol refactor Signed-off-by: blam --- .../src/app/createExtensionTester.test.tsx | 14 +++----------- .../src/app/renderInTestApp.tsx | 4 ++-- .../SearchResultListItemBlueprint.test.tsx | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx b/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx index 582bbeed00..a6265ae3ac 100644 --- a/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx +++ b/packages/frontend-test-utils/src/app/createExtensionTester.test.tsx @@ -30,7 +30,6 @@ const stringDataRef = createExtensionDataRef().with({ describe('createExtensionTester', () => { it('should return the correct dataRef when called', () => { const extension = createExtension({ - namespace: 'test', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], factory: () => [stringDataRef('test-text')], @@ -43,7 +42,6 @@ describe('createExtensionTester', () => { it('should throw an error if trying to access an instance not provided to the tester', () => { const extension = createExtension({ - namespace: 'test', name: 'e1', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], @@ -51,7 +49,6 @@ describe('createExtensionTester', () => { }); const extension2 = createExtension({ - namespace: 'test', name: 'e2', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], @@ -61,13 +58,12 @@ describe('createExtensionTester', () => { const tester = createExtensionTester(extension); expect(() => tester.query(extension2)).toThrow( - "Extension with ID 'test/e2' not found, please make sure it's added to the tester", + "Extension with ID 'e2' not found, please make sure it's added to the tester", ); }); it('should throw an error if trying to access an instance which is not part of the tree', () => { const extension = createExtension({ - namespace: 'test', name: 'e1', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], @@ -75,7 +71,6 @@ describe('createExtensionTester', () => { }); const extension2 = createExtension({ - namespace: 'test', name: 'e2', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef], @@ -85,7 +80,7 @@ describe('createExtensionTester', () => { const tester = createExtensionTester(extension).add(extension2); expect(() => tester.query(extension2)).toThrow( - "Extension with ID 'test/e2' has not been instantiated, because it is not part of the test subject's extension tree", + "Extension with ID 'e2' has not been instantiated, because it is not part of the test subject's extension tree", ); }); @@ -99,7 +94,6 @@ describe('createExtensionTester', () => { }); const extension = createExtension({ - namespace: 'test', name: 'e1', attachTo: { id: 'ignored', input: 'ignored' }, output: [stringDataRef, internalRef.optional()], @@ -129,7 +123,6 @@ describe('createExtensionTester', () => { }); const extension = createExtension({ - namespace: 'test', name: 'e1', inputs: { ignored: createExtensionInput([stringDataRef]), @@ -140,9 +133,8 @@ describe('createExtensionTester', () => { }); const extraExtension = createExtension({ - namespace: 'test', name: 'e2', - attachTo: { id: 'test/e1', input: 'ignored' }, + attachTo: { id: 'e1', input: 'ignored' }, output: [stringDataRef, internalRef.optional()], factory: () => [stringDataRef('test-text')], }); diff --git a/packages/frontend-test-utils/src/app/renderInTestApp.tsx b/packages/frontend-test-utils/src/app/renderInTestApp.tsx index fae67a260c..80897e942a 100644 --- a/packages/frontend-test-utils/src/app/renderInTestApp.tsx +++ b/packages/frontend-test-utils/src/app/renderInTestApp.tsx @@ -25,7 +25,6 @@ import { ConfigReader } from '@backstage/config'; import { JsonObject } from '@backstage/types'; import { createExtension, - createExtensionOverrides, ExtensionDefinition, coreExtensionData, RouteRef, @@ -33,6 +32,7 @@ import { IconComponent, RouterBlueprint, NavItemBlueprint, + createExtensionOverrides, } from '@backstage/frontend-plugin-api'; import appPlugin from '@backstage/plugin-app'; @@ -182,10 +182,10 @@ export function renderInTestApp( } const features: FrontendFeature[] = [ - appPluginOverride, createExtensionOverrides({ extensions, }), + appPluginOverride, ]; if (options?.features) { diff --git a/plugins/search-react/src/alpha/blueprints/SearchResultListItemBlueprint.test.tsx b/plugins/search-react/src/alpha/blueprints/SearchResultListItemBlueprint.test.tsx index b50ca9e55a..6b8f75d70c 100644 --- a/plugins/search-react/src/alpha/blueprints/SearchResultListItemBlueprint.test.tsx +++ b/plugins/search-react/src/alpha/blueprints/SearchResultListItemBlueprint.test.tsx @@ -87,7 +87,7 @@ describe('SearchResultListItemBlueprint', () => { }); const mockSearchPage = PageBlueprint.makeWithOverrides({ - namespace: 'search', + name: 'search', inputs: { items: createExtensionInput([searchResultListItemDataRef]), },