Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva committed Nov 30, 2023
1 parent 387d325 commit d2a28fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
17 changes: 11 additions & 6 deletions src/test/tests/dependencyUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -120,7 +125,7 @@ describe('Dependency Utils Tests', () => {
testCases.forEach(test => {
it('Create impacted tree - ' + test.name, async () => {
let impactedTree: Map<string, IImpactGraph> = 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<string> = DependencyUtils.getDirectComponents(impactedTree);
assert.sameMembers(test.expectedDirect, Array.from(direct));
Expand Down
5 changes: 2 additions & 3 deletions src/test/tests/yarnImpactGraph.test.ts
Original file line number Diff line number Diff line change
@@ -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 () => {
Expand Down Expand Up @@ -85,7 +84,7 @@ function generateExpectedSingleImpactGraph(): IImpactGraph {
}
]
},
pathsLimit: RootNode.IMPACT_PATHS_LIMIT
pathsLimit: undefined
};
}

Expand Down Expand Up @@ -138,6 +137,6 @@ function generateExpectedMultipleImpactGraphs(): IImpactGraph {
}
]
},
pathsLimit: RootNode.IMPACT_PATHS_LIMIT
pathsLimit: undefined
};
}

0 comments on commit d2a28fd

Please sign in to comment.