diff --git a/src/main/treeDataProviders/dependenciesTree/dependenciesRoot/rootTree.ts b/src/main/treeDataProviders/dependenciesTree/dependenciesRoot/rootTree.ts index 1fe30397..e92da0db 100644 --- a/src/main/treeDataProviders/dependenciesTree/dependenciesRoot/rootTree.ts +++ b/src/main/treeDataProviders/dependenciesTree/dependenciesRoot/rootTree.ts @@ -109,7 +109,7 @@ export class RootNode extends DependenciesTreeNode { return { root: { children: impactPaths }, pathsLimit: size } as IImpactGraph; } - public static createImpactPathLimit(totalPath: number | undefined) { + public static createImpactPathLimit(totalPath: number | undefined): number | undefined { if (totalPath === RootNode.IMPACT_PATHS_LIMIT) { return totalPath; } diff --git a/src/test/tests/dependencyUtils.test.ts b/src/test/tests/dependencyUtils.test.ts index 6267471a..4978e904 100644 --- a/src/test/tests/dependencyUtils.test.ts +++ b/src/test/tests/dependencyUtils.test.ts @@ -81,33 +81,38 @@ describe('Dependency Utils Tests', () => { { name: 'A:1.0.0' } as IImpactGraphNode, { name: 'C:2.0.0', children: [{ name: 'A:1.0.0' } as IImpactGraphNode] } as IImpactGraphNode ] - } as IImpactGraphNode + } as IImpactGraphNode, + pathsLimit: undefined } as IImpactGraph); map.set('XRAY-191882' + 'C:2.0.0', { root: { name: root.componentId, children: [{ name: 'C:2.0.0' } as IImpactGraphNode] - } + }, + pathsLimit: undefined } as IImpactGraph); // issue XRAY-94201, for components B:1.0.0 map.set('XRAY-94201' + 'B:1.0.0', { root: { name: root.componentId, children: [{ name: 'B:1.0.0' } as IImpactGraphNode] - } + }, + pathsLimit: undefined } as IImpactGraph); // issue XRAY-142007, for components [A:1.0.1, C:2.0.0] map.set('XRAY-142007' + 'A:1.0.1', { root: { name: root.componentId, children: [{ name: 'B:1.0.0', children: [{ name: 'A:1.0.1' } as IImpactGraphNode] } as IImpactGraphNode] - } + }, + pathsLimit: undefined } as IImpactGraph); map.set('XRAY-142007' + 'C:2.0.0', { root: { name: root.componentId, children: [{ name: 'C:2.0.0' } as IImpactGraphNode] - } + }, + pathsLimit: undefined } as IImpactGraph); return map; } @@ -120,7 +125,7 @@ describe('Dependency Utils Tests', () => { testCases.forEach(test => { it('Create impacted tree - ' + test.name, async () => { let impactedTree: Map = DependencyUtils.createImpactedGraph(root, test.response); - assert.deepEqual(test.expectedTree, Object.fromEntries(impactedTree.entries())); + assert.deepEqual(Object.fromEntries(impactedTree.entries()), test.expectedTree); // Test get direct components let direct: Set = DependencyUtils.getDirectComponents(impactedTree); assert.sameMembers(test.expectedDirect, Array.from(direct)); diff --git a/src/test/tests/yarnImpactGraph.test.ts b/src/test/tests/yarnImpactGraph.test.ts index fce2240b..e56250db 100644 --- a/src/test/tests/yarnImpactGraph.test.ts +++ b/src/test/tests/yarnImpactGraph.test.ts @@ -1,7 +1,6 @@ import { IImpactGraph } from 'jfrog-ide-webview'; import { YarnImpactGraphCreator, YarnWhyItem } from '../../main/treeDataProviders/utils/yarnImpactGraph'; import { assert } from 'chai'; -import { RootNode } from '../../main/treeDataProviders/dependenciesTree/dependenciesRoot/rootTree'; import { LogManager } from '../../main/log/logManager'; describe('Yarn impact graph util', async () => { @@ -85,7 +84,7 @@ function generateExpectedSingleImpactGraph(): IImpactGraph { } ] }, - pathsLimit: RootNode.IMPACT_PATHS_LIMIT + pathsLimit: undefined }; } @@ -138,6 +137,6 @@ function generateExpectedMultipleImpactGraphs(): IImpactGraph { } ] }, - pathsLimit: RootNode.IMPACT_PATHS_LIMIT + pathsLimit: undefined }; }