Skip to content

Commit

Permalink
[ANE-698] Add an integration test for NuGet fallback to project.asset…
Browse files Browse the repository at this point in the history
…s.json
  • Loading branch information
jcc333 committed Jan 10, 2025
1 parent fb2edbc commit cb7b6e4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/features/manual-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ Note: When parsed, YAML considers text that could be a decimal number (such as 1
Supported dependency types:

- `bower` - Bower dependencies that are typically found at [bower.io](https://registry.bower.io).
- <!-- markdown-link-check-disable-next-line -->
<!-- markdown-link-check-disable-next-line -->
- `cargo` - Rust dependencies that are typically found at [crates.io](https://crates.io/).
- `carthage` - Dependencies as specified by the [Carthage](https://github.com/Carthage/Carthage) package manager.
- `composer` - Dependencies specified by the PHP package manager [Composer](https://getcomposer.org/), which are located on [Packagist](https://packagist.org/).
- `cpan` - Dependencies located on the [CPAN package manager](https://www.cpan.org/).
- <!-- markdown-link-check-disable-next-line -->
<!-- markdown-link-check-disable-next-line -->
- `cran` - Dependencies located on the [CRAN](https://cran.r-project.org/) like repository.
- `gem` - Dependencies which can be found at [RubyGems.org](https://rubygems.org/).
- `git` - Github projects (which appear as dependencies in many package managers). Specified as the full GitHub repository `https://github.com/fossas/fossa-cli`.
Expand Down
31 changes: 30 additions & 1 deletion integration-test/Analysis/NugetSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module Analysis.NugetSpec (spec) where
import Analysis.FixtureExpectationUtils
import Analysis.FixtureUtils
import App.Types (Mode (NonStrict))
import Data.Set qualified as Set
import Data.Set (member)
import Discovery.Walk (fileName)
import Path

import Strategy.NuGet qualified as NuGet
Expand All @@ -25,9 +28,22 @@ serviceStack discoveryFunc =
[reldir|nuget/ServiceStack/|]
[reldir|servicestack-5.13.2//|]

dotnetCoreTwoExample :: (Path Abs Dir -> TestC IO [DiscoveredProject a]) -> AnalysisTestFixture a
dotnetCoreTwoExample discoveryFunc =
AnalysisTestFixture
"dotnet-core-2.0-example"
discoveryFunc
LocalEnvironment
Nothing
$ FixtureArtifact
"https://github.com/james-fossa/dotnet-core-2.0-example/archive/refs/tags/0.0.1.tar.gz"
[reldir|nuget/dotnet-core-2.0-example-0.0.1/|]
[reldir|dotnet-core-2.0-example-0.0.1//|]


testServiceStackForPkgReferences :: Spec
testServiceStackForPkgReferences =
aroundAll (withAnalysisOf NonStrict $ serviceStack PackageReference.discover) $ do
aroundAll (withAnalysisOf NonStrict $ serviceStack NuGet.discover) $ do
describe "ServiceStack" $ do
it "should find targets" $ \(result, _) -> do
length result `shouldBe` 64
Expand All @@ -39,7 +55,20 @@ testServiceStackForPkgConfig =
it "should find targets" $ \(result, _) -> do
length result `shouldBe` 4

testDotnetCoreTwoExampleForPackageAssetsJson :: Spec
testDotnetCoreTwoExampleForPackageAssetsJson =
aroundAll (withAnalysisOf NonStrict $ dotnetCoreTwoExample NuGet.discover) $ do
describe "dotnet-core-2.0-example" $ do
it "should find targets" $ \(result, _) -> do
length result `shouldBe` 2
let projectDataPaths = Set.fromList $ map (fileName . NuGet.nugetProjectFile . Types.projectData . fst) result
let doesProjectAssetsJsonTargetExist = member "project.assets.json" projectDataPaths
let doesCsprojTargetExist = member "example.csproj" projectDataPaths
doesProjectAssetsJsonTargetExist `shouldBe` True
doesCsprojTargetExist `shouldBe` True

spec :: Spec
spec = do
testServiceStackForPkgReferences
testServiceStackForPkgConfig
testDotnetCoreTwoExampleForPackageAssetsJson

0 comments on commit cb7b6e4

Please sign in to comment.