0.2.72 - Magic button, Next up fixes

This commit is contained in:
ponzischeme89
2026-08-17 11:41:36 +12:00
parent 36cb1324fd
commit 12b27c77c3
2655 changed files with 5435 additions and 254 deletions
+28
View File
@@ -30,6 +30,34 @@ func TestNormalizePreferencesDropsUnknownKeys(t *testing.T) {
}
}
func TestNormalizePreferencesBoundsAndNormalisesProfileInitials(t *testing.T) {
if got := normalizePreferences(map[string]any{"profileInitials": " mc "})["profileInitials"]; got != "MC" {
t.Errorf("profileInitials = %v, want MC", got)
}
for _, value := range []any{"MAT", "M\nC", 12} {
if got := normalizePreferences(map[string]any{"profileInitials": value})["profileInitials"]; got != "" {
t.Errorf("profileInitials for %v = %v, want automatic fallback", value, got)
}
}
}
func TestDevicePreferenceWritePreservesAdminInitials(t *testing.T) {
stored, err := json.Marshal(normalizePreferences(map[string]any{"profileInitials": "MC"}))
if err != nil {
t.Fatal(err)
}
merged := preserveAdminPreferences(map[string]any{
"profileInitials": "XX", "showTitleLogo": false,
}, stored)
normalised := normalizePreferences(merged)
if normalised["profileInitials"] != "MC" {
t.Errorf("profileInitials = %v, want preserved MC", normalised["profileInitials"])
}
if normalised["showTitleLogo"] != false {
t.Errorf("showTitleLogo = %v, want device change false", normalised["showTitleLogo"])
}
}
func TestNormalizePreferencesRejectsIllegalValues(t *testing.T) {
result := normalizePreferences(map[string]any{
"homeCardDensity": "enormous",