Skip to content

Commit

Permalink
test(nuget): Use more fine-granular grouping of tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Jul 9, 2024
1 parent e8e80c2 commit 3a37300
Showing 1 changed file with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,43 @@

package org.ossreviewtoolkit.plugins.packagemanagers.nuget.utils

import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.WordSpec
import io.kotest.matchers.shouldBe

import org.ossreviewtoolkit.model.Identifier

class NuGetUtilsTest : WordSpec({
"getIdentifierWithNamespace()" should {
"split the namespace from the name" {
assertSoftly {
getIdentifierWithNamespace("NuGet", "SharpCompress", "0.23.0") shouldBe
Identifier("NuGet::SharpCompress:0.23.0")
"use an empty namespace if only a name is present" {
getIdentifierWithNamespace("NuGet", "SharpCompress", "0.23.0") shouldBe
Identifier("NuGet::SharpCompress:0.23.0")
}

getIdentifierWithNamespace("NuGet", "System.IO", "4.1.0") shouldBe
Identifier("NuGet:System:IO:4.1.0")
getIdentifierWithNamespace("NuGet", "System.IO.Compression", "4.3.0") shouldBe
Identifier("NuGet:System.IO:Compression:4.3.0")
getIdentifierWithNamespace("NuGet", "System.IO.Compression.ZipFile", "4.0.1") shouldBe
Identifier("NuGet:System.IO:Compression.ZipFile:4.0.1")
"use up to two dot-separated components from the name as the namespace" {
getIdentifierWithNamespace("NuGet", "System.IO", "4.1.0") shouldBe
Identifier("NuGet:System:IO:4.1.0")
getIdentifierWithNamespace("NuGet", "System.IO.Compression", "4.3.0") shouldBe
Identifier("NuGet:System.IO:Compression:4.3.0")
getIdentifierWithNamespace("NuGet", "System.IO.Compression.ZipFile", "4.0.1") shouldBe
Identifier("NuGet:System.IO:Compression.ZipFile:4.0.1")
}

getIdentifierWithNamespace(
"NuGet",
"Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore",
"2.2.1"
) shouldBe Identifier(
"NuGet:Microsoft.Extensions:Diagnostics.HealthChecks.EntityFrameworkCore:2.2.1"
)
"keep multiple dot-separated components as part of the name" {
getIdentifierWithNamespace(
"NuGet",
"Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore",
"2.2.1"
) shouldBe Identifier(
"NuGet:Microsoft.Extensions:Diagnostics.HealthChecks.EntityFrameworkCore:2.2.1"
)

getIdentifierWithNamespace(
"NuGet",
"Microsoft.AspNetCore.Components.WebAssembly.Build.BrotliCompression",
"3.1.6"
) shouldBe Identifier(
"NuGet:Microsoft.AspNetCore:Components.WebAssembly.Build.BrotliCompression:3.1.6"
)
}
getIdentifierWithNamespace(
"NuGet",
"Microsoft.AspNetCore.Components.WebAssembly.Build.BrotliCompression",
"3.1.6"
) shouldBe Identifier(
"NuGet:Microsoft.AspNetCore:Components.WebAssembly.Build.BrotliCompression:3.1.6"
)
}
}
})

0 comments on commit 3a37300

Please sign in to comment.