From b0bd41857e8db029db71c9eceb58f532ce6fb9fd Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Tue, 17 Sep 2024 09:07:34 +0200 Subject: [PATCH] test(node): Merge `NpmVersionUrlFunTest` into `NpmFunTest` The version URL test case is similar to the test cases in `NpmFunTest`, so move it there for consistency. Signed-off-by: Frank Viernau --- .../node/src/funTest/kotlin/NpmFunTest.kt | 12 +++++ .../funTest/kotlin/NpmVersionUrlFunTest.kt | 48 ------------------- 2 files changed, 12 insertions(+), 48 deletions(-) delete mode 100644 plugins/package-managers/node/src/funTest/kotlin/NpmVersionUrlFunTest.kt diff --git a/plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt b/plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt index c9a6d7308d52e..41c20f7e37272 100644 --- a/plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt +++ b/plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt @@ -130,5 +130,17 @@ class NpmFunTest : WordSpec({ result.withInvariantIssues() shouldBe expectedResult.withInvariantIssues() } + + "resolve dependencies with URLs as versions correctly" { + val definitionFile = getAssetFile("projects/synthetic/npm-version-urls/package.json") + val expectedResultFile = getAssetFile("projects/synthetic/npm-version-urls-expected-output.yml") + val expectedResult = patchExpectedResult(expectedResultFile, definitionFile) + .fromYaml() + + val result = create("NPM", allowDynamicVersions = true) + .resolveSingleProject(definitionFile, resolveScopes = true) + + result.withInvariantIssues().toYaml() shouldBe expectedResult.withInvariantIssues().toYaml() + } } }) diff --git a/plugins/package-managers/node/src/funTest/kotlin/NpmVersionUrlFunTest.kt b/plugins/package-managers/node/src/funTest/kotlin/NpmVersionUrlFunTest.kt deleted file mode 100644 index 7301c8c265e28..0000000000000 --- a/plugins/package-managers/node/src/funTest/kotlin/NpmVersionUrlFunTest.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2017 The ORT Project Authors (see ) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * License-Filename: LICENSE - */ - -package org.ossreviewtoolkit.plugins.packagemanagers.node - -import io.kotest.core.spec.style.WordSpec -import io.kotest.matchers.shouldBe - -import org.ossreviewtoolkit.analyzer.create -import org.ossreviewtoolkit.analyzer.resolveSingleProject -import org.ossreviewtoolkit.analyzer.withInvariantIssues -import org.ossreviewtoolkit.model.ProjectAnalyzerResult -import org.ossreviewtoolkit.model.fromYaml -import org.ossreviewtoolkit.model.toYaml -import org.ossreviewtoolkit.utils.test.getAssetFile -import org.ossreviewtoolkit.utils.test.patchExpectedResult - -class NpmVersionUrlFunTest : WordSpec({ - "NPM" should { - "resolve dependencies with URLs as versions correctly" { - val definitionFile = getAssetFile("projects/synthetic/npm-version-urls/package.json") - val expectedResultFile = getAssetFile("projects/synthetic/npm-version-urls-expected-output.yml") - val expectedResult = patchExpectedResult(expectedResultFile, definitionFile) - .fromYaml() - - val result = create("NPM", allowDynamicVersions = true) - .resolveSingleProject(definitionFile, resolveScopes = true) - - result.withInvariantIssues().toYaml() shouldBe expectedResult.withInvariantIssues().toYaml() - } - } -})