Files
core/solutions/knowledge/assets_test.go
T

34 lines
684 B
Go
Raw Normal View History

package knowledge
import (
"os"
"path/filepath"
"testing"
"yetano.dev/yetano/core/solutions/catalog"
)
func assetsIndex(t *testing.T) *Index {
t.Helper()
dir, _ := filepath.Abs("../../../assets/solutions")
if _, err := os.Stat(filepath.Join(dir, "catalog.yaml")); err != nil {
t.Skip("assets/solutions not present")
}
c, err := catalog.Load(dir)
if err != nil {
t.Fatal(err)
}
return Build(c)
}
func TestAssetsLint(t *testing.T) {
ix := assetsIndex(t)
for _, i := range Lint(ix) {
if i.Severity == "error" {
t.Error(i)
} else {
t.Log(i)
}
}
t.Logf("%d entries, %d manual topics, missing sources: %v", len(ix.Entries), len(ix.Topics), ix.Missing)
}