fix(test): Replaced use of GraphCompare with graph assertions in NpmOutputParserTest
@@ -24,16 +24,16 @@ package com.synopsys.integration.detectable.detectables.npm.lockfile.functional;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Disabled;
+
+import com.synopsys.integration.bdio.model.Forge;
import com.synopsys.integration.bdio.model.externalid.ExternalIdFactory;
import com.synopsys.integration.detectable.detectables.npm.cli.parse.NpmCliParser;
import com.synopsys.integration.detectable.detectables.npm.lockfile.model.NpmParseResult;
import com.synopsys.integration.detectable.util.FunctionalTestFiles;
-import com.synopsys.integration.detectable.util.GraphCompare;
+import com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert;
public class NpmOutputParserTest {
@Test
- @Disabled
public void npmCliDependencyFinder() {
final NpmCliParser parser = new NpmCliParser(new ExternalIdFactory());
final String testIn = FunctionalTestFiles.asString("/npm/packman_proj_dependencies.json");
@@ -41,6 +41,14 @@ public class NpmOutputParserTest {
Assertions.assertEquals("node-js", result.getProjectName());
Assertions.assertEquals("0.2.0", result.getProjectVersion());
- GraphCompare.assertEqualsResource("/npm/npmParseOutput_graph.json", result.getCodeLocation().getDependencyGraph());
+
+ final NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, result.getCodeLocation().getDependencyGraph());
+
+ graphAssert.hasRootSize(2);
+ graphAssert.hasRootDependency("xml2js", "0.4.17");
+ graphAssert.hasRootDependency("upper-case", "1.1.3");
+ graphAssert.hasParentChildRelationship("xml2js", "0.4.17", "xmlbuilder", "4.2.1");
+ graphAssert.hasParentChildRelationship("xml2js", "0.4.17", "sax", "1.2.2");
+ graphAssert.hasParentChildRelationship("xmlbuilder", "4.2.1", "lodash", "4.17.4");
}
}
