Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package company
|
|
|
|
import "testing"
|
|
|
|
func TestBrandKit_PromptBlock(t *testing.T) {
|
|
empty := BrandKit{}
|
|
if empty.PromptBlock() != "" {
|
|
t.Fatalf("empty should yield empty prompt")
|
|
}
|
|
b := BrandKit{
|
|
VoiceTone: "confident, concise",
|
|
Dos: []string{"Lead with benefit"},
|
|
Donts: []string{"No hype"},
|
|
PreferredTerms: []string{"wireless", "premium"},
|
|
}
|
|
got := b.PromptBlock()
|
|
for _, want := range []string{"Brand:", "confident", "Lead with benefit", "No hype", "wireless"} {
|
|
if !contains(got, want) {
|
|
t.Fatalf("prompt missing %q: %s", want, got)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestBrandKit_FormulaTips(t *testing.T) {
|
|
b := BrandKit{VoiceTone: "warm", PreferredTerms: []string{"eco"}}
|
|
tips := b.FormulaTips()
|
|
if len(tips) < 2 {
|
|
t.Fatalf("tips=%v", tips)
|
|
}
|
|
}
|
|
|
|
func TestCleanStringsDedup(t *testing.T) {
|
|
got := cleanStrings([]string{" A ", "a", "", "B"})
|
|
if len(got) != 2 || got[0] != "A" || got[1] != "B" {
|
|
t.Fatalf("got=%v", got)
|
|
}
|
|
}
|
|
|
|
func contains(s, sub string) bool {
|
|
return len(s) >= len(sub) && (s == sub || len(sub) == 0 ||
|
|
(func() bool {
|
|
for i := 0; i+len(sub) <= len(s); i++ {
|
|
if s[i:i+len(sub)] == sub {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
})())
|
|
}
|