chore: smol refactor

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-09-03 07:59:02 +02:00
parent d7f25e1d43
commit 1ac573b4f3
3 changed files with 6 additions and 14 deletions
@@ -30,7 +30,6 @@ const stringDataRef = createExtensionDataRef<string>().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')],
});
@@ -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) {
@@ -87,7 +87,7 @@ describe('SearchResultListItemBlueprint', () => {
});
const mockSearchPage = PageBlueprint.makeWithOverrides({
namespace: 'search',
name: 'search',
inputs: {
items: createExtensionInput([searchResultListItemDataRef]),
},