Files
core/solutions/engine/assets_test.go
T
terminarandClaude Opus 5.5 2481a0dd27 solutions: Solutions Guide engine (catalog, rules, wizard state, native config, knowledge index, CLI)
New nested module yetano.dev/yetano/core/solutions: loads the catalog
in assets/solutions on top of the Big Picture, evaluates questions and
conditions, resolves packages/modules/capabilities, generates native
configuration from typed fragments with per-value origins, and builds
architecture graph, plan, lock file and handbook. Knowledge index with
yetano: references, search and lint (incl. manual sections). CLI with
yet's conventions (solution, task, knowledge, open), standalone as
yetano-solutions. No execution, no network.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 08:42:58 +01:00

54 lines
1.2 KiB
Go

package engine
import (
"os"
"path/filepath"
"testing"
"yetano.dev/yetano/core/solutions/catalog"
)
// The meta-repo's catalog, when this module is checked out inside it.
func assetsCatalog(t *testing.T) *catalog.Catalog {
t.Helper()
dir, _ := filepath.Abs("../../../assets/solutions")
if _, err := os.Stat(filepath.Join(dir, "catalog.yaml")); err != nil {
t.Skip("assets/solutions not present (module outside the meta-repo)")
}
c, err := catalog.Load(dir)
if err != nil {
for _, i := range c.Issues {
t.Log(i)
}
t.Fatal(err)
}
return c
}
func TestAssetsCatalog(t *testing.T) {
c := assetsCatalog(t)
for _, i := range c.Validate() {
if i.Severity == "error" {
t.Error(i)
} else {
t.Log(i)
}
}
e := New(c)
for _, key := range catalog.SortedIDs(c.Examples) {
x := c.Examples[key]
in := NewInstance(x.Meta.ID, c.Lookup(x.Spec.Solution), x.Spec.Mode)
in.Spec.Parameters = x.Spec.Parameters
st, err := e.Evaluate(in, nil)
if err != nil {
t.Fatalf("%s: %v", key, err)
}
if !st.Complete {
t.Errorf("%s: not complete: %s", key, incompleteText(st))
}
for _, m := range st.Messages {
t.Logf("%s: %s %s", key, m.Severity, m.Text)
}
}
}