mirror of
https://github.com/safedep/vet.git
synced 2025-12-11 17:44:20 -06:00
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
31 lines
604 B
Go
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())
|
|
})
|
|
}
|
|
}
|