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

@@ -2,6 +2,7 @@ package main
import (
"bytes"
"context"
"crypto/sha256"
"net/http"
"net/http/httptest"
@@ -18,6 +19,7 @@ import (
"git.golem15.com/golem15/summercms/phrasebook"
"git.golem15.com/golem15/summercms/postcard"
"git.golem15.com/golem15/summercms/surf"
"git.golem15.com/golem15/summercms/towel"
)
func TestGreeterHelloPrintsLayeredConfig(t *testing.T) {
@@ -122,6 +124,13 @@ func TestHelloPluginResolvesLang(t *testing.T) {
if !ok {
t.Fatal("translator not published")
}
ctx := towel.WithLocale(context.Background(), "pl")
if got := tr.Get(ctx, "golem15.hello::lang.greeting", nil); got != "Cześć" {
t.Fatalf("towel locale = %q", got)
}
if got := tr.Get(context.Background(), "golem15.hello::lang.greeting", nil); got != "Hello" {
t.Fatalf("app locale default = %q", got)
}
if got := tr.GetIn("en", "golem15.hello::lang.labels.pluginName", nil); got != "Hello plugin" {
t.Fatalf("en = %q", got)
}