All checks were successful
release-tag / release-image (push) Successful in 1m52s
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
package background
|
|
|
|
import "testing"
|
|
|
|
func TestBuildSupportsAllLanguages(t *testing.T) {
|
|
for _, lang := range []string{"de", "en", "fr", "es", "it", "nl", "pt", "pl"} {
|
|
page := Build(lang)
|
|
if page.Title == "" || page.Lead == "" || page.DisclaimerText == "" {
|
|
t.Fatalf("language %s has incomplete primary content", lang)
|
|
}
|
|
if len(page.OverviewParagraphs) < 3 {
|
|
t.Fatalf("language %s has insufficient overview content", lang)
|
|
}
|
|
if len(page.Obligations) != 4 || len(page.Scenarios) != 4 || len(page.Principles) != 4 {
|
|
t.Fatalf("language %s has incomplete structured content", lang)
|
|
}
|
|
if len(page.Sources) != 5 {
|
|
t.Fatalf("language %s has %d sources, want 5", lang, len(page.Sources))
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestGermanPageDistinguishesLegalAndVoluntaryDisclosure(t *testing.T) {
|
|
page := Build("de")
|
|
if page.OverviewTitle == "" {
|
|
t.Fatal("missing overview title")
|
|
}
|
|
foundVoluntary := false
|
|
foundPublicInterest := false
|
|
for _, scenario := range page.Scenarios {
|
|
if scenario.Status == "Oft freiwillige Transparenz" {
|
|
foundVoluntary = true
|
|
}
|
|
if scenario.Title == "KI-generierter Text zu Angelegenheiten von öffentlichem Interesse" {
|
|
foundPublicInterest = true
|
|
}
|
|
}
|
|
if !foundVoluntary || !foundPublicInterest {
|
|
t.Fatal("German page does not distinguish voluntary and potentially mandatory disclosure")
|
|
}
|
|
}
|
|
|
|
func TestUnknownLanguageFallsBackToEnglish(t *testing.T) {
|
|
page := Build("xx")
|
|
if page.Title != "Content needs context." {
|
|
t.Fatalf("unexpected fallback title %q", page.Title)
|
|
}
|
|
}
|