vet/pkg/parser/parser_test.go
abhisek b662145492
feat: Refactor CycloneDX parser into CycloneDX Graph Parser
refactor: CDX graph parser to improve readability

fix: Set dependency graph present only when BOM contains at least 1 dependency relation

chore: Add a root note while graph rendering (reporter)

chore: Remove old cyclonedx files

test: Add maven cyclonedx sbom test case
2024-02-02 15:29:34 +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, 13, 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())
})
}
}