Files
felhom-controller/controller/internal/web/w29_decommission_card_test.go
T

36 lines
1.2 KiB
Go

package web
import (
"strings"
"testing"
)
// W29 (rehearsal 2026-10-20): after a plain decommission (nothing moved) the storage card read „Kiváltva — Adatok
// átköltöztetve ide: . () Időpont: …" — the move sentence with empty blanks. With no move it says the drive was
// decommissioned and that nothing was moved off it; a real move keeps its sentence.
func TestW29_PlainDecommissionNamesNoMove(t *testing.T) {
s := i18nTestServer(t)
want := map[string][2]string{
"hu": {"Leszerelve. Nem költöztettünk át adatot róla", "Adatok átköltöztetve ide"},
"en": {"Decommissioned. No data was moved off it", "Data moved to"},
}
for _, c := range i18nCases() {
switch c.name {
case "storage_decommissioned_plain":
for lang, w := range want {
page := renderI18nCase(t, s, lang, c)
if !strings.Contains(page, w[0]) || strings.Contains(page, w[1]) {
t.Errorf("%s: a plain decommission must say %q and never %q", lang, w[0], w[1])
}
}
case "storage_full": // a real move keeps its sentence
for lang, w := range want {
page := renderI18nCase(t, s, lang, c)
if !strings.Contains(page, w[1]) || strings.Contains(page, w[0]) {
t.Errorf("%s: a decommission with a move must say %q", lang, w[1])
}
}
}
}
}