From 6c0b4b6d1d4795b9eb1b0cf22668dba08a57df0e Mon Sep 17 00:00:00 2001 From: attiasas Date: Mon, 30 Sep 2024 19:11:29 +0300 Subject: [PATCH] fix tests --- tests/utils/test_utils.go | 14 ++++++++++++++ utils/results/output/securityJobSummary_test.go | 4 ---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/utils/test_utils.go b/tests/utils/test_utils.go index 9f4b2a47..f42c23e3 100644 --- a/tests/utils/test_utils.go +++ b/tests/utils/test_utils.go @@ -176,6 +176,15 @@ func convertSarifRunPathsForOS(runs ...*sarif.Run) { *location.PhysicalLocation.ArtifactLocation.URI = getJasConvertedPath(sarifutils.GetLocationFileName(location)) } } + for _, codeFlow := range result.CodeFlows { + for _, threadFlows := range codeFlow.ThreadFlows { + for _, location := range threadFlows.Locations { + if location != nil && location.Location != nil && location.Location.PhysicalLocation != nil && location.Location.PhysicalLocation.ArtifactLocation != nil && location.Location.PhysicalLocation.ArtifactLocation.URI != nil { + *location.Location.PhysicalLocation.ArtifactLocation.URI = getJasConvertedPath(sarifutils.GetLocationFileName(location.Location)) + } + } + } + } } } } @@ -217,6 +226,11 @@ func convertJasSimpleJsonPathsForOS(jas *formats.SourceCodeRow) { return } jas.Location.File = getJasConvertedPath(jas.Location.File) + if jas.Applicability != nil { + for _, evidence := range jas.Applicability.Evidence { + evidence.Location.File = getJasConvertedPath(evidence.Location.File) + } + } for _, codeFlow := range jas.CodeFlow { for _, location := range codeFlow { location.File = getJasConvertedPath(location.File) diff --git a/utils/results/output/securityJobSummary_test.go b/utils/results/output/securityJobSummary_test.go index 0324e0f2..ef744c81 100644 --- a/utils/results/output/securityJobSummary_test.go +++ b/utils/results/output/securityJobSummary_test.go @@ -45,10 +45,6 @@ func TestSaveSarifOutputOnlyForJasEntitled(t *testing.T) { name string isJasEntitled bool }{ - { - name: "JAS entitled", - isJasEntitled: true, - }, { name: "JAS not entitled", isJasEntitled: false,