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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user