vet/pkg/parser/parser_test.go
abhisek a69cd670b4
feat: Add support for jar scanning
refactor: Parser target resolver to re-use from lockfile and directory reader

feat: Add support for scope based parse target resolution

refactor: Dir reader to use config struct

test: Fix directory reader tests

refactor: Rename parser utils to resolver

doc: Add jar scanning example in README.md
2024-09-07 15:45:32 +05:30

31 lines
604 B
Go

package parser
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestListParser(t *testing.T) {
parsers := List(false)
assert.Equal(t, 15, len(parsers))
}
func TestInvalidEcosystemMapping(t *testing.T) {
pw := &parserWrapper{parseAs: "nothing"}
assert.Empty(t, pw.Ecosystem())
}
func TestEcosystemMapping(t *testing.T) {
for _, lf := range List(false) {
t.Run(lf, func(t *testing.T) {
// For graph parsers, we add a tag to the end of the name
lf = strings.Split(lf, " ")[0]
pw := &parserWrapper{parseAs: lf}
assert.NotEmpty(t, pw.Ecosystem())
})
}
}