Skip to content

Add more settings model unit tests#20117

Open
carlos-zamora wants to merge 1 commit intomainfrom
dev/cazamor/test/settings-model
Open

Add more settings model unit tests#20117
carlos-zamora wants to merge 1 commit intomainfrom
dev/cazamor/test/settings-model

Conversation

@carlos-zamora
Copy link
Copy Markdown
Member

Summary of the Pull Request

Adds tests to UnitTests_SettingsModel to improve coverage. Tests include:

  • SettingInheritanceFallback: Settings inherit from user defaults; unset settings fall back to built-in defaults
  • ClearSettingRestoresInheritance: ClearXxx() removes the value at the current layer, causing fallback to the parent
  • HasSettingAtSpecificLayer: HasXxx() distinguishes explicitly set values from inherited ones
  • ModifyProfileSettingAndRoundtrip: Change a profile setting via setter and ToJson() reflects it
  • ModifyGlobalSettingAndRoundtrip: Change global settings via setter and ToJson() reflects them
  • ModifyColorSchemeAndRoundtrip: Change a color scheme property and the serialized JSON reflects it
  • FixupUserSettingsDetectsChanges: A clean roundtrip produces idempotent FixupUserSettings() (returns false)
  • FixupCommandlinePatching: 4 sub-cases: CMD/PowerShell short names get patched to full paths, no-op when already clean, custom profiles are untouched

This also updates TestCloneInheritanceTree to verify that HasXxx() and settters that modify the clone don't modify the original.

This is being done in preparation for auto-save to help ensure we don't have any regressions.

Validation Steps Performed

✅ Tests pass
✅ Manually reviewed the new tests, they make sense and do add value (though some are less valuable than others, admittedly)
✅ Sent Copilot on a quest to ensure we're not adding redundant tests. It did catch a few and remove them fwiw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant