Files
felhom.eu/documentation/audits/app-guides-2026-10-15/tools/loader_check_test.go.txt
T

35 lines
1.3 KiB
Plaintext

package stacks
// SCRATCH ONLY (app-guides night, 2026-10-15): the real catalog templates through the controller's own loader.
// Never committed — it lives in a throwaway copy of the repo.
import (
"os"
"path/filepath"
"strings"
"testing"
)
func TestScratch_RealCatalogGuides(t *testing.T) {
root := os.Getenv("CATALOG_TEMPLATES")
apps := strings.Split(os.Getenv("GUIDE_APPS"), ",")
for _, app := range apps {
m := LoadMetadata(filepath.Join(root, app))
g := m.AppInfo.Guide
en := m.For("en").AppInfo.Guide
es, ef := m.GuideOverlayExtras("en")
t.Logf("%s: rendered=%v checked=%q sections=%d faq=%d | en: sections=%d faq=%d first=%q extras=%d/%d",
app, g.Rendered(), g.CheckedVersion, len(g.Sections), len(g.FAQ), len(en.Sections), len(en.FAQ),
func() string { if len(en.Sections) > 0 { return en.Sections[0].Title }; return "" }(), es, ef)
if !g.Rendered() || len(g.Sections) < 3 || len(g.FAQ) < 4 {
t.Errorf("%s: guide not rendered or too short", app)
}
if len(en.Sections) != len(g.Sections) || en.Sections[0].Title == g.Sections[0].Title || es != 0 || ef != 0 {
t.Errorf("%s: English overlay not applied as expected", app)
}
if en.CheckedVersion != g.CheckedVersion {
t.Errorf("%s: checked_version moved under the overlay", app)
}
}
}