Skip to content

Commit

Permalink
Adds test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
djschleen authored Jan 6, 2025
1 parent 396cdf8 commit 1320f51
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion providers/gad/gad.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func init() {
// Provider represents the OSSIndex provider
type Provider struct{}

// SupportedEcosystems returns a list of ecosystems supported by the Github Advisory Database
func (Provider) SupportedEcosystems() []string {
return []string{
"github-actions",
Expand All @@ -39,7 +40,6 @@ func (Provider) SupportedEcosystems() []string {
"npm",
"nuget",
"pypi",
"pypi",
"rubygems",
"cargo",
}
Expand Down
19 changes: 19 additions & 0 deletions providers/gad/gad_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gad

import (
"reflect"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -11,3 +12,21 @@ func TestInfo(t *testing.T) {
info := provider.Info()
assert.Equal(t, "GitHub Advisory Database (https://github.com/advisories)", info)
}

func TestProvider_SupportedEcosystems(t *testing.T) {
provider := Provider{}
expectedEcosystems := []string{
"github-actions",
"composer",
"erlang",
"golang",
"maven",
"npm",
"nuget",
"pypi",
"rubygems",
"cargo",
}
actualEcosystems := provider.SupportedEcosystems()
assert.True(t, reflect.DeepEqual(expectedEcosystems, actualEcosystems), "Expected %v but got %v", expectedEcosystems, actualEcosystems)
}

0 comments on commit 1320f51

Please sign in to comment.