Search in sources :

Example 6 with NpmDependency

use of com.synopsys.integration.detectable.detectables.npm.lockfile.model.NpmDependency 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);
}
Also used : PackageLock(com.synopsys.integration.detectable.detectables.npm.lockfile.model.PackageLock) NpmLockfileGraphTransformer(com.synopsys.integration.detectable.detectables.npm.lockfile.parse.NpmLockfileGraphTransformer) NpmDependency(com.synopsys.integration.detectable.detectables.npm.lockfile.model.NpmDependency) NpmProject(com.synopsys.integration.detectable.detectables.npm.lockfile.model.NpmProject) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ArrayList(java.util.ArrayList) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test)

Aggregations

NpmDependency (com.synopsys.integration.detectable.detectables.npm.lockfile.model.NpmDependency)6 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)2 Dependency (com.synopsys.integration.bdio.model.dependency.Dependency)2 ArrayList (java.util.ArrayList)2 BasicDependencyGraph (com.synopsys.integration.bdio.graph.BasicDependencyGraph)1 ExternalId (com.synopsys.integration.bdio.model.externalid.ExternalId)1 NpmProject (com.synopsys.integration.detectable.detectables.npm.lockfile.model.NpmProject)1 NpmRequires (com.synopsys.integration.detectable.detectables.npm.lockfile.model.NpmRequires)1 PackageLock (com.synopsys.integration.detectable.detectables.npm.lockfile.model.PackageLock)1 PackageLockDependency (com.synopsys.integration.detectable.detectables.npm.lockfile.model.PackageLockDependency)1 NpmLockfileGraphTransformer (com.synopsys.integration.detectable.detectables.npm.lockfile.parse.NpmLockfileGraphTransformer)1 GraphAssert (com.synopsys.integration.detectable.util.graph.GraphAssert)1 Map (java.util.Map)1 Test (org.junit.jupiter.api.Test)1