refactor(settings): guard all Settings fields vs null; tidy import + test

Guard colorMode and glyphMode against null in the Settings compact
constructor (alongside the existing musicLevel guard), so a hand-edited
settings.json with a missing field no longer NPEs in SettingsMenu.
Remove the unused MusicLevel import from SettingsMenu. Assert that the
defaulted musicLevel survives a round-trip in SettingsStoreTest.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 23:17:26 +02:00
parent 2bad875df1
commit bcd2ae9ddd
3 changed files with 7 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ class SettingsStoreTest {
Settings loaded = store.load();
assertThat(loaded.colorMode()).isEqualTo(ConsoleIO.ColorMode.ON);
assertThat(loaded.glyphMode()).isEqualTo(ConsoleIO.GlyphMode.ASCII);
assertThat(loaded.musicLevel()).isEqualTo(MusicLevel.MEDIUM);
}
@Test