use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class NpmDevExclusionTest method testDevDependencyNotExists.
@Test
public void testDevDependencyNotExists() {
NpmPackagerResult result = createPackager(NpmDependencyType.DEV, NpmDependencyType.PEER).parseAndTransform(packageJsonText, packageLockText);
GraphAssert graphAssert = new GraphAssert(Forge.NPMJS, result.getCodeLocation().getDependencyGraph());
graphAssert.hasNoDependency(childDev);
graphAssert.hasNoDependency(parentDev);
graphAssert.hasRootSize(0);
}
use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class NpmDevExclusionTest method testDevDependencyExists.
@Test
public void testDevDependencyExists() {
NpmPackagerResult result = createPackager(NpmDependencyType.PEER).parseAndTransform(packageJsonText, packageLockText);
GraphAssert graphAssert = new GraphAssert(Forge.NPMJS, result.getCodeLocation().getDependencyGraph());
graphAssert.hasDependency(childDev);
graphAssert.hasDependency(parentDev);
graphAssert.hasRootSize(1);
}
use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class NpmWithoutRequiresExcludesTest method testDevDependencyExcluded.
@Test
public void testDevDependencyExcluded() {
PackageLock packageLock = new PackageLock();
packageLock.dependencies = new HashMap<>();
List<NpmDependency> resolvedDependencies = new ArrayList<>();
resolvedDependencies.add(new NpmDependency("example", "1.0.0", true, true));
NpmProject npmProject = new NpmProject(Strings.EMPTY, Strings.EMPTY, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), resolvedDependencies);
NpmLockfileGraphTransformer graphTransformer = new NpmLockfileGraphTransformer(EnumListFilter.fromExcluded(NpmDependencyType.DEV, NpmDependencyType.PEER));
DependencyGraph graph = graphTransformer.transform(packageLock, npmProject, Collections.emptyList());
GraphAssert graphAssert = new GraphAssert(Forge.NPMJS, graph);
graphAssert.hasRootSize(0);
}
use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class PackageJsonExtractorFunctionalTest method extractWithPeerDependencies.
@Test
void extractWithPeerDependencies() {
Extraction extraction = createExtractor(NpmDependencyType.DEV).extract(packageJsonInputStream);
assertEquals(1, extraction.getCodeLocations().size());
CodeLocation codeLocation = extraction.getCodeLocations().get(0);
DependencyGraph dependencyGraph = codeLocation.getDependencyGraph();
GraphAssert graphAssert = new GraphAssert(Forge.RUBYGEMS, dependencyGraph);
graphAssert.hasRootDependency(testDep1);
graphAssert.hasRootDependency(testDep2);
graphAssert.hasRootDependency(testPeerDep1);
graphAssert.hasRootDependency(testPeerDep2);
graphAssert.hasNoDependency(testDevDep1);
graphAssert.hasNoDependency(testDevDep2);
graphAssert.hasRootSize(4);
}
use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class PearDependencyGraphTransformerTest method buildDependencyGraphRequiredOnly.
@Test
void buildDependencyGraphRequiredOnly() {
DependencyGraph dependencyGraph = buildDependencyGraph(PearDependencyType.OPTIONAL);
Set<Dependency> rootDependencies = dependencyGraph.getRootDependencies();
Assertions.assertEquals(1, rootDependencies.size());
ExternalIdFactory externalIdFactory = new ExternalIdFactory();
GraphAssert graphAssert = new GraphAssert(Forge.PEAR, dependencyGraph);
graphAssert.hasDependency(externalIdFactory.createNameVersionExternalId(Forge.PEAR, "Archive_Tar", "1.4.3"));
}
Aggregations