Files
ImaGen/internal/prompt/prompt_test.go
mAi f8dd5e0736 mAi: add 6 style presets — cinematic, watercolor, anime, 3d-render, line-art, isometric
Cross-coordination with flexsiebels/head (paul). m wants more style options
on /imagine/new; flexsiebels has the UI side ready to bump IMAGEN_STYLES
in lib/server/imagen.ts + schemas.ts as soon as the worker accepts them.

styles.yaml: 6 new entries with FLUX-friendly prompt fragments. No code
changes — Apply() and Styles() consume the embedded YAML directly, the
"enum" is dynamic.

prompt_test.go: extend TestStylesContainsAllExpected expectation list
(alphabetical, '3' < 'a' so 3d-render leads).

Total enum: 11 (5 existing + 6 new). flexsiebels delegation message 1669.
2026-05-11 21:15:23 +02:00

51 lines
1.2 KiB
Go

package prompt
import "testing"
func TestApplyKnownStyle(t *testing.T) {
got, err := Apply("a cat", "photo")
if err != nil {
t.Fatalf("Apply: %v", err)
}
want := "a cat, photorealistic, sharp focus, natural lighting"
if got != want {
t.Errorf("got %q, want %q", got, want)
}
}
func TestApplyEmptyStylePassThrough(t *testing.T) {
got, err := Apply("a cat", "")
if err != nil || got != "a cat" {
t.Errorf("got (%q,%v)", got, err)
}
}
func TestApplyUnknownStyleErrors(t *testing.T) {
if _, err := Apply("a cat", "nonsense"); err == nil {
t.Errorf("expected error for unknown style")
}
}
func TestApplyToEmptyPromptUsesPresetOnly(t *testing.T) {
got, err := Apply("", "photo")
if err != nil {
t.Fatalf("Apply: %v", err)
}
if got == "" || got[0] == ',' {
t.Errorf("unexpected output %q", got)
}
}
func TestStylesContainsAllExpected(t *testing.T) {
want := []string{"3d-render", "anime", "blog-header", "cinematic", "diagram", "illustration", "isometric", "line-art", "photo", "sketch", "watercolor"}
got := Styles()
if len(got) != len(want) {
t.Fatalf("Styles() = %v, want %v", got, want)
}
for i, w := range want {
if got[i] != w {
t.Errorf("Styles()[%d] = %q, want %q", i, got[i], w)
}
}
}