Skip to content

Commit

Permalink
tests for vendor from url logic
Browse files Browse the repository at this point in the history
Signed-off-by: Weston Steimel <weston.steimel@anchore.com>
  • Loading branch information
westonsteimel committed Feb 24, 2023
1 parent ab6a031 commit 187c745
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions syft/pkg/cataloger/common/cpe/vendors_from_url_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package cpe

import (
"testing"

"github.com/stretchr/testify/assert"
)

func Test_candidateVendorsFromURL(t *testing.T) {
tests := []struct {
name string
url string
expected []string
}{
{
name: "empty",
url: "",
expected: []string{},
},
{
name: "no known vendors",
url: "https://something-unknown.com/126374623876/12345",
expected: []string{},
},
{
name: "gnu vendor from url",
url: "https://www.gnu.org/software/make",
expected: []string{"gnu"},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
assert.ElementsMatch(t, test.expected, candidateVendorsFromURL(test.url).uniqueValues(), "different vendors")
})
}
}

0 comments on commit 187c745

Please sign in to comment.