Skip to content

Commit a9aebdb

Browse files
committed
cocoapods-audit
1 parent 8c56a03 commit a9aebdb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

commands/audit/sca/cocoapods/cocoapods_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
66
"github.com/jfrog/jfrog-cli-core/v2/utils/tests"
77
"github.com/jfrog/jfrog-cli-security/utils/techutils"
8+
"github.com/owenrumney/go-sarif/v2/sarif"
89
"os"
910
"path/filepath"
1011
"strings"
@@ -72,6 +73,22 @@ func TestGetTechDependencyLocation(t *testing.T) {
7273
assert.Equal(t, *locations[0].PhysicalLocation.Region.Snippet.Text, "GoogleSignIn', '~> 6.2.4'")
7374
}
7475

76+
func TestPodLineParse(t *testing.T) {
77+
var podPositions []*sarif.Location
78+
foundDependency, _, startLine, startCol := parsePodLine("pod 'GoogleSignIn', '~> 6.2.4'", "GoogleSignIn", "6.2.4", "test", 0, 0, 0, 0, 0, 0, []string{"pod 'GoogleSignIn', '~> 6.2.4'"}, false, &podPositions)
79+
assert.Equal(t, foundDependency, false)
80+
assert.Equal(t, startLine, 0)
81+
assert.Equal(t, startCol, 5)
82+
}
83+
84+
func TestPodLineParseFoundOnlyDependencyName(t *testing.T) {
85+
var podPositions []*sarif.Location
86+
foundDependency, _, startLine, startCol := parsePodLine("pod 'GoogleSignIn', '~> 6.2.3'", "GoogleSignIn", "6.2.4", "test", 0, 0, 0, 0, 0, 0, []string{"pod 'GoogleSignIn', '~> 6.2.3'"}, false, &podPositions)
87+
assert.Equal(t, foundDependency, true)
88+
assert.Equal(t, startLine, 0)
89+
assert.Equal(t, startCol, 5)
90+
}
91+
7592
func TestFixTechDependencySingleLocation(t *testing.T) {
7693
_, cleanUp := sca.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods"))
7794
defer cleanUp()

0 commit comments

Comments
 (0)