Skip to content

Commit

Permalink
test(oss-index): Use coordinates as keys
Browse files Browse the repository at this point in the history
Improve output of assertion failures within `forAll`.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Dec 13, 2024
1 parent f85dcc8 commit 21e67c3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions plugins/advisors/oss-index/src/test/kotlin/OssIndexTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ class OssIndexTest : WordSpec({
OssIndexConfiguration("http://localhost:${server.port()}", null, null)
)

val result = ossIndex.retrievePackageFindings(PACKAGES).mapKeys { it.key.id }

result.keys shouldContainExactlyInAnyOrder PACKAGES.map { it.id }
result.forAll { (_, advisorResult) ->
advisorResult.advisor shouldBe ossIndex.details
advisorResult.vulnerabilities should beEmpty()
advisorResult.summary.issues shouldHaveSingleElement { it.severity == Severity.ERROR }
val result = ossIndex.retrievePackageFindings(PACKAGES).mapKeys { it.key.id.toCoordinates() }

result.keys shouldContainExactlyInAnyOrder PACKAGES.map { it.id.toCoordinates() }
result.keys.forAll { coordinates ->
with(result.getValue(coordinates)) {
advisor shouldBe ossIndex.details
vulnerabilities should beEmpty()
summary.issues shouldHaveSingleElement { it.severity == Severity.ERROR }
}
}
}

Expand Down

0 comments on commit 21e67c3

Please sign in to comment.