Add a test that would have caught the bug last week (#38222)

This adds a test to make sure that the default value of the auto update
setting is always true. We manually re-applied the broken code from last
week, and confirmed that this test fails with that code.

Release Notes:

- N/A

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Mikayla Maki
2025-09-15 18:10:28 +00:00
committed by GitHub
co-authored by Ben Kunkle Conrad Irwin
parent 6384966ab5
commit 9046091164
3 changed files with 23 additions and 1 deletions
+19
View File
@@ -992,8 +992,27 @@ pub fn finalize_auto_update_on_quit() {
#[cfg(test)]
mod tests {
use gpui::TestAppContext;
use settings::default_settings;
use super::*;
#[gpui::test]
fn test_auto_update_defaults_to_true(cx: &mut TestAppContext) {
cx.update(|cx| {
let mut store = SettingsStore::new(cx);
store
.set_default_settings(&default_settings(), cx)
.expect("Unable to set default settings");
store
.set_user_settings("{}", cx)
.expect("Unable to set user settings");
cx.set_global(store);
AutoUpdateSetting::register(cx);
assert!(AutoUpdateSetting::get_global(cx).0);
});
}
#[test]
fn test_stable_does_not_update_when_fetched_version_is_not_higher() {
let release_channel = ReleaseChannel::Stable;