Verify current catalog examples through native ConfigKit loading

This commit is contained in:
2026-11-29 16:35:01 +00:00
parent bb88ca12d0
commit d479df5d1d
4 changed files with 114 additions and 115 deletions

View File

@@ -29,8 +29,8 @@ func TestCatalogSelection(t *testing.T) {
}
record := catalog.Schemas[0]
next := record
next.Version = "0.2.0"
next.Path = "glossary/v0.2.0/schema.json"
next.Version = "99.0.0"
next.Path = "glossary/v99.0.0/schema.json"
next.ID = schemaBase + next.Path
var schema map[string]any
if err := json.Unmarshal(files[record.Path].Data, &schema); err != nil {
@@ -57,11 +57,12 @@ func TestCatalogSelection(t *testing.T) {
if err != nil {
t.Fatal(err)
}
old, err := set.Select("glossary@0.1.0")
old := set.schemas[record.ID]
_, err = set.Select("glossary")
if err != nil {
t.Fatal(err)
}
newer, err := set.Select("glossary@0.2.0")
newer, err := set.Select("glossary")
if err != nil {
t.Fatal(err)
}
@@ -72,8 +73,8 @@ func TestCatalogSelection(t *testing.T) {
if err := newer.Validate(value); err == nil {
t.Fatal("selection did not distinguish definitions sharing a marker")
}
if _, err := set.Select("glossary"); err == nil {
t.Fatal("implicit latest selection accepted")
if _, err := set.Select("glossary@0.1.0"); err == nil {
t.Fatal("historical selection accepted")
}
for _, change := range []func(){
func() { catalog.Schemas = append(catalog.Schemas, record) },