frontend-app-api: rename buildAppGraph -> resolveAppGraph

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-10-18 13:02:12 +02:00
parent d844ec8a0b
commit 65b6a91894
3 changed files with 12 additions and 12 deletions
@@ -26,7 +26,7 @@ import {
instantiateAppNodeTree,
} from './instantiateAppNodeTree';
import { AppNodeInstance, AppNodeSpec } from './types';
import { buildAppGraph } from './buildAppGraph';
import { resolveAppGraph } from './resolveAppGraph';
const testDataRef = createExtensionDataRef<string>('test');
const otherDataRef = createExtensionDataRef<number>('other');
@@ -79,7 +79,7 @@ function makeInstanceWithId<TConfig>(
describe('instantiateAppNodeTree', () => {
it('should instantiate a single node', () => {
const graph = buildAppGraph(
const graph = resolveAppGraph(
[{ ...makeSpec(simpleExtension), id: 'root-node' }],
'root-node',
);
@@ -94,7 +94,7 @@ describe('instantiateAppNodeTree', () => {
});
it('should not instantiate disabled nodes', () => {
const graph = buildAppGraph(
const graph = resolveAppGraph(
[{ ...makeSpec(simpleExtension), id: 'root-node', disabled: true }],
'root-node',
);
@@ -104,7 +104,7 @@ describe('instantiateAppNodeTree', () => {
});
it('should instantiate a node with attachments', () => {
const graph = buildAppGraph(
const graph = resolveAppGraph(
[
{
...makeSpec(
@@ -151,7 +151,7 @@ describe('instantiateAppNodeTree', () => {
});
it('should not instantiate disabled attachments', () => {
const graph = buildAppGraph(
const graph = resolveAppGraph(
[
{
...makeSpec(
@@ -15,7 +15,7 @@
*/
import { createExtension } from '@backstage/frontend-plugin-api';
import { buildAppGraph } from './buildAppGraph';
import { resolveAppGraph } from './resolveAppGraph';
const extBaseConfig = {
id: 'test',
@@ -34,13 +34,13 @@ const baseSpec = {
describe('buildAppGraph', () => {
it('should fail to create an empty graph', () => {
expect(() => buildAppGraph([])).toThrow(
expect(() => resolveAppGraph([])).toThrow(
"No root node with id 'core' found in app graph",
);
});
it('should create a graph with only one node', () => {
const graph = buildAppGraph([{ ...baseSpec, id: 'core' }]);
const graph = resolveAppGraph([{ ...baseSpec, id: 'core' }]);
expect(graph.root).toEqual({
spec: { ...baseSpec, id: 'core' },
edges: { attachments: new Map() },
@@ -50,7 +50,7 @@ describe('buildAppGraph', () => {
});
it('should create a graph', () => {
const graph = buildAppGraph(
const graph = resolveAppGraph(
[
{ ...baseSpec, id: 'a' },
{ ...baseSpec, id: 'b' },
@@ -116,7 +116,7 @@ describe('buildAppGraph', () => {
});
it('should create a graph out of order', () => {
const graph = buildAppGraph(
const graph = resolveAppGraph(
[
{ ...baseSpec, attachTo: { id: 'b', input: 'x' }, id: 'bx2' },
{ ...baseSpec, id: 'a' },
@@ -163,7 +163,7 @@ describe('buildAppGraph', () => {
it('throws an error when duplicated extensions are detected', () => {
expect(() =>
buildAppGraph([
resolveAppGraph([
{ ...baseSpec, id: 'a' },
{ ...baseSpec, id: 'a' },
]),
@@ -87,7 +87,7 @@ class SerializableAppNode implements AppNode {
* tree with all attachments in the same order as they appear in the input specs array.
* @internal
*/
export function buildAppGraph(
export function resolveAppGraph(
specs: AppNodeSpec[],
rootNodeId = 'core',
): AppGraph {