Skip to content

Commit

Permalink
spec is passing
Browse files Browse the repository at this point in the history
  • Loading branch information
spatten committed May 29, 2024
1 parent 3c981e1 commit 3378156
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/App/Fossa/SBOM/Analyze.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module App.Fossa.SBOM.Analyze (
analyze,
analyzeInternal,
) where

import App.Fossa.API.BuildLink (getFossaBuildUrl)
Expand Down
12 changes: 7 additions & 5 deletions test/App/Fossa/SBOMAnalyzeSpec.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{-# LANGUAGE TemplateHaskell #-}

module App.Fossa.SBOMAnalyzeSpec (spec) where

import App.Fossa.Config.SBOM.Analyze (SBOMAnalyzeConfig (..))
import App.Fossa.Config.SBOM.Common (SBOMFile (..))
import App.Fossa.SBOM.Analyze (analyze)
import App.Fossa.SBOM.Analyze (analyzeInternal)
import App.Types (BaseDir (..), ComponentUploadFileType (..), DependencyRebuild (DependencyRebuildReuseCache), ProjectRevision (ProjectRevision))
import Control.Algebra (Has)
import Control.Carrier.Debug (ignoreDebug)
Expand All @@ -21,17 +23,17 @@ spec = do
describe "SBOM Analyze" $ do
currDir <- runIO getCurrentDir
it' "should upload a file" $ do
let revision = ProjectRevision "somesbom" "1.2.3" Nothing
let archive = Archive "somesbom" "1.2.3"
let revision = ProjectRevision "somesbom" "1.2.3" Nothing
let config = SBOMAnalyzeConfig (BaseDir currDir) Fixtures.apiOpts (SBOMFile "test/App/Fossa/SBOM/testdata/sampleCycloneDX.json") SevInfo DependencyRebuildReuseCache Nothing revision

GetApiOpts `alwaysReturns` Fixtures.apiOpts
expectOrganization
expectGetSignedUrl PackageRevision{packageName = "somesbom", packageVersion = "1.2.3"}
expectUploadArchive
expectQueueSBOMBuild archive
expectOrganization

_ <- ignoreDebug . withoutTelemetry . runMockApi $ analyze config
pure ()
ignoreDebug . withoutTelemetry . runMockApi $ analyzeInternal config

expectOrganization :: Has MockApi sig m => m ()
expectOrganization = GetOrganization `alwaysReturns` Fixtures.organization
Expand Down
1 change: 1 addition & 0 deletions test/Test/MockApi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ matchExpectation a@(GetSignedLicenseScanUrl{}) (ApiExpectation _ requestExpectat
matchExpectation a@(GetSignedFirstPartyScanUrl{}) (ApiExpectation _ requestExpectation b@(GetSignedFirstPartyScanUrl{}) resp) = checkResult requestExpectation a b resp
matchExpectation a@(GetSignedUploadUrl{}) (ApiExpectation _ requestExpectation b@(GetSignedUploadUrl{}) resp) = checkResult requestExpectation a b resp
matchExpectation a@(QueueArchiveBuild{}) (ApiExpectation _ requestExpectation b@(QueueArchiveBuild{}) resp) = checkResult requestExpectation a b resp
matchExpectation a@(QueueSBOMBuild{}) (ApiExpectation _ requestExpectation b@(QueueSBOMBuild{}) resp) = checkResult requestExpectation a b resp
matchExpectation a@(ResolveProjectDependencies{}) (ApiExpectation _ requestExpectation b@(ResolveProjectDependencies{}) resp) = checkResult requestExpectation a b resp
matchExpectation a@(ResolveUserDefinedBinary{}) (ApiExpectation _ requestExpectation b@(ResolveUserDefinedBinary{}) resp) = checkResult requestExpectation a b resp
matchExpectation a@(UploadAnalysis{}) (ApiExpectation _ requestExpectation b@(UploadAnalysis{}) resp) = checkResult requestExpectation a b resp
Expand Down

0 comments on commit 3378156

Please sign in to comment.