test(04-04): close translation lookup and catalog boundary coverage

- Cover nested groups, malformed paths, invalid pipes, and compass locale
- Name plugin, file, and key on activation catalog failures
- Prove hello activation reads the translator through towel.WithLocale

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-09-18 14:10:29 +02:00
parent 85bdb51c36
commit 918e941e69
3 changed files with 123 additions and 0 deletions

View File

@@ -457,6 +457,26 @@ func TestActivateMalformedLangFailsWithPluginContext(t *testing.T) {
}
}
func TestActivateMalformedLangLeafNamesFileAndKey(t *testing.T) {
p := &langPlugin{
id: "golem15.hello",
fsys: fstest.MapFS{
"lang/en/lang.yaml": {Data: []byte("labels:\n count: 1\n")},
},
}
app := backpack.New(&compass.Config{})
_, err := activate([]Plugin{p}, app, []string{"golem15.hello"})
if err == nil {
t.Fatal("expected non-string leaf error")
}
msg := err.Error()
for _, want := range []string{"golem15.hello", "lang/en/lang.yaml", "labels.count", "non-string leaf"} {
if !strings.Contains(msg, want) {
t.Fatalf("error %q missing %s", msg, want)
}
}
}
type mailPlugin struct {
id string
fsys fs.FS