-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: parsing of artifact data to get component group/name/version
Updated in accordance with: https://github.com/CycloneDX/cyclonedx-node-npm/blob/main/docs/result.md
- Loading branch information
Showing
4 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.mockito.ArgumentMatchers.eq; | ||
import static org.mockito.Mockito.when; | ||
|
@@ -216,6 +217,9 @@ private static void verifyAddedNpmDependencies(Bom processed) { | |
assertEquals("https://pnc.example.com/pnc-rest/v2/artifacts/2160610", onceArtifact.getUrl()); | ||
assertTrue(getDependency("pkg:npm/[email protected]", mainDependency.getDependencies()).isPresent()); | ||
assertTrue(getDependency("pkg:npm/[email protected]", processed.getDependencies()).isPresent()); | ||
assertNull(componentOnce.getGroup()); | ||
assertEquals("once", componentOnce.getName()); | ||
assertEquals("1.4.0", componentOnce.getVersion()); | ||
|
||
Component componentKogito = getComponent( | ||
processed, | ||
|
@@ -241,6 +245,9 @@ private static void verifyAddedNpmDependencies(Bom processed) { | |
getDependency( | ||
"pkg:npm/%40redhat/[email protected]", | ||
processed.getDependencies()).isPresent()); | ||
assertEquals("@redhat", componentKogito.getGroup()); | ||
assertEquals("kogito-tooling-keyboard-shortcuts", componentKogito.getName()); | ||
assertEquals("0.9.0-2", componentKogito.getVersion()); | ||
} | ||
|
||
private static Optional<Dependency> getDependency(String ref, List<Dependency> dependencies) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters