package catalogue import ( "os" "strings" "testing" ) // The indexer and the builder hold no published list of predefined keys; a manifest whose config values fall back to // one (claude-code, dunst, xterm at mesh-catalog 835bf22b) is still read for its build's and fingerprint's inputs // (issue 1751). func TestParseManifestForInputsReadsAValueFallingBackToAPredefinedKey(t *testing.T) { // issue 1751 was := ReplacePublished(nil) // the indexer's and the builder's case: no published list defer ReplacePublished(was) for _, module := range []string{"claude-code", "dunst", "xterm"} { raw, err := os.ReadFile("testdata/catalogue-835bf22b-" + module + ".module.json") if err != nil { t.Fatal(err) } if _, err := ParseManifest(raw); err == nil { t.Fatalf("%s: ParseManifest reads it with no list; the test proves nothing", module) } if m, err := ParseManifestForInputs(raw); err != nil || m.Module != module { t.Errorf("%s: %v", module, err) } } } func TestParseManifestForInputsStillRefusesWhatTheParserRefuses(t *testing.T) { // issue 1751 was := ReplacePublished(nil) defer ReplacePublished(was) raw, _ := os.ReadFile("testdata/catalogue-835bf22b-xterm.module.json") bad := strings.Replace(string(raw), `"predefined": "font-size"`, `"predefined": "font-size", "trusted": "yes"`, 1) if bad == string(raw) { t.Fatal("the fixture no longer names font-size; the test proves nothing") } if _, err := ParseManifestForInputs([]byte(bad)); err == nil { t.Error("a manifest the parser refuses was read") } }