File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,34 @@ class PackageCurationTest : WordSpec({
387387 result.metadata.declaredLicensesProcessed.spdxExpression shouldBe expression
388388 }
389389 }
390+
391+ " preserve OR operator when mapping makes previously invalid licenses valid" {
392+ // This test case demonstrates a bug where two declared licenses - one valid SPDX and one
393+ // invalid that needs mapping - are incorrectly combined with AND instead of OR.
394+ val pkg = Package .EMPTY .copy(
395+ declaredLicenses = setOf("Apache -2.0", "GNU Lesser General Public License v2.1 only"),
396+ // In reality, the initial processing only mapped the valid license
397+ declaredLicensesProcessed = ProcessedDeclaredLicense (
398+ spdxExpression = "Apache -2.0".toSpdx(),
399+ unmapped = setOf("GNU Lesser General Public License v2.1 only")
400+ )
401+ )
402+
403+ val curation = PackageCuration (
404+ id = pkg.id,
405+ data = PackageCurationData (
406+ declaredLicenseMapping = mapOf(
407+ "GNU Lesser General Public License v2.1 only" to "LGPL -2.1-only".toSpdx()
408+ )
409+ )
410+ )
411+
412+ val result = curation.apply(pkg.toCuratedPackage())
413+
414+ // Expected: Since the package originally declared two separate licenses, they should be
415+ // combined with OR (dual-licensing), not AND (both licenses apply).
416+ result.metadata.declaredLicensesProcessed.spdxExpression shouldBe " Apache-2.0 OR LGPL-2.1-only" .toSpdx()
417+ }
390418 }
391419
392420 " isApplicable()" should {
You can’t perform that action at this time.
0 commit comments