address comments

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-01-10 20:48:32 +01:00
parent b2d370ee7e
commit 26d774f63a
14 changed files with 14 additions and 29 deletions
@@ -280,8 +280,6 @@ export interface BackstagePlugin<
readonly id: string;
// (undocumented)
readonly routes: Routes;
// (undocumented)
toString(): string;
}
export { BackstageUserIdentity };
@@ -742,8 +740,6 @@ export interface Extension<TConfig> {
readonly disabled: boolean;
// (undocumented)
readonly id: string;
// (undocumented)
toString(): string;
}
// @public (undocumented)
@@ -772,7 +768,6 @@ export type ExtensionDataRef<
T: TData;
config: TConfig;
$$type: '@backstage/ExtensionDataRef';
toString(): string;
};
// @public
@@ -809,8 +804,6 @@ export interface ExtensionDefinition<TConfig> {
readonly name?: string;
// (undocumented)
readonly namespace?: string;
// (undocumented)
toString(): string;
}
// @public (undocumented)
@@ -833,8 +826,6 @@ export interface ExtensionInput<
export interface ExtensionOverrides {
// (undocumented)
readonly $$type: '@backstage/ExtensionOverrides';
// (undocumented)
toString(): string;
}
// @public (undocumented)
@@ -20,6 +20,6 @@ describe('createComponentRef', () => {
it('can be created and read', () => {
const ref = createComponentRef({ id: 'foo' });
expect(ref.id).toBe('foo');
expect(String(ref)).toBe('componentRef{id=foo}');
expect(String(ref)).toBe('ComponentRef{id=foo}');
});
});
@@ -27,6 +27,8 @@ export function createComponentRef<T extends {} = {}>(options: {
const { id } = options;
return {
id,
toString: () => `componentRef{id=${id}}`,
toString() {
return `ComponentRef{id=${id}}`;
},
} as ComponentRef<T>;
}
@@ -15,5 +15,3 @@
*/
import '@testing-library/jest-dom';
(global as unknown as { CSSOM: any }).CSSOM = { parse() {} };
@@ -288,7 +288,7 @@ describe('createExtension', () => {
});
expect(extension.namespace).toBe('test');
expect(String(extension)).toBe(
'extensionDefinition{namespace=test,attachTo=root@default}',
'ExtensionDefinition{namespace=test,attachTo=root@default}',
);
});
});
@@ -107,7 +107,6 @@ export interface ExtensionDefinition<TConfig> {
readonly attachTo: { id: string; input: string };
readonly disabled: boolean;
readonly configSchema?: PortableSchema<TConfig>;
toString(): string;
}
/** @internal */
@@ -121,7 +120,6 @@ export interface InternalExtensionDefinition<TConfig>
config: TConfig;
inputs: ResolvedExtensionInputs<any>;
}): ExtensionDataValues<any>;
toString(): string;
}
/** @internal */
@@ -180,7 +178,7 @@ export function createExtension<
parts.push(`name=${options.name}`);
}
parts.push(`attachTo=${options.attachTo.id}@${options.attachTo.input}`);
return `extensionDefinition{${parts.join(',')}}`;
return `ExtensionDefinition{${parts.join(',')}}`;
},
} as InternalExtensionDefinition<TConfig>;
}
@@ -20,9 +20,9 @@ describe('createExtensionDataRef', () => {
it('can be created and read', () => {
const ref = createExtensionDataRef('foo');
expect(ref.id).toBe('foo');
expect(String(ref)).toBe('extensionDataRef{id=foo,optional=false}');
expect(String(ref)).toBe('ExtensionDataRef{id=foo,optional=false}');
const refOptional = ref.optional();
expect(refOptional.id).toBe('foo');
expect(String(refOptional)).toBe('extensionDataRef{id=foo,optional=true}');
expect(String(refOptional)).toBe('ExtensionDataRef{id=foo,optional=true}');
});
});
@@ -23,7 +23,6 @@ export type ExtensionDataRef<
T: TData;
config: TConfig;
$$type: '@backstage/ExtensionDataRef';
toString(): string;
};
/** @public */
@@ -51,7 +50,7 @@ export function createExtensionDataRef<TData>(
},
toString() {
const optional = Boolean(this.config.optional);
return `extensionDataRef{id=${id},optional=${optional}}`;
return `ExtensionDataRef{id=${id},optional=${optional}}`;
},
} as ConfigurableExtensionDataRef<TData, { optional?: true }>;
}
@@ -50,7 +50,7 @@ export function createExtensionOverrides(
toString() {
const ex = extensions.map(String).join(',');
const ff = featureFlags.map(f => f.name).join(',');
return `extensionOverrides{extensions=[${ex}],featureFlags=[${ff}]}`;
return `ExtensionOverrides{extensions=[${ex}],featureFlags=[${ff}]}`;
},
} as InternalExtensionOverrides;
}
@@ -138,7 +138,7 @@ describe('createPlugin', () => {
const plugin = createPlugin({ id: 'test' });
expect(plugin).toBeDefined();
expect(String(plugin)).toBe('plugin{id=test}');
expect(String(plugin)).toBe('Plugin{id=test}');
});
it('should create a plugin with extension instances', async () => {
@@ -83,7 +83,7 @@ export function createPlugin<
featureFlags: options.featureFlags ?? [],
extensions,
toString() {
return `plugin{id=${options.id}}`;
return `Plugin{id=${options.id}}`;
},
} as InternalBackstagePlugin<Routes, ExternalRoutes>;
}
@@ -37,7 +37,7 @@ describe('resolveExtensionDefinition', () => {
...definition,
} as ExtensionDefinition<unknown>);
expect(resolved.id).toBe(expected);
expect(String(resolved)).toBe(`extension{id=${expected}}`);
expect(String(resolved)).toBe(`Extension{id=${expected}}`);
});
it('should fail to resolve extension ID without namespace', () => {
@@ -32,7 +32,6 @@ export interface Extension<TConfig> {
readonly attachTo: { id: string; input: string };
readonly disabled: boolean;
readonly configSchema?: PortableSchema<TConfig>;
toString(): string;
}
/** @internal */
@@ -90,7 +89,7 @@ export function resolveExtensionDefinition<TConfig>(
version: 'v1',
id,
toString() {
return `extension{id=${id}}`;
return `Extension{id=${id}}`;
},
} as Extension<TConfig>;
}
@@ -41,13 +41,11 @@ export interface BackstagePlugin<
readonly id: string;
readonly routes: Routes;
readonly externalRoutes: ExternalRoutes;
toString(): string;
}
/** @public */
export interface ExtensionOverrides {
readonly $$type: '@backstage/ExtensionOverrides';
toString(): string;
}
/** @public */