Fix scoped gRPC persistence and autosave behavior
This commit is contained in:
@@ -5618,6 +5618,33 @@ func TestUISyncDefaultsPersistInSettings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIRemoteAutosavePersistsInSettings(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
configPath := filepath.Join(t.TempDir(), "settings.json")
|
||||
|
||||
first := newUIWithSession("desktop", &session.Manager{}, statePaths{
|
||||
SettingsPath: configPath,
|
||||
})
|
||||
first.autoSaveRemote = true
|
||||
first.state.AutoSaveRemote = true
|
||||
first.saveSettings()
|
||||
|
||||
second := newUIWithSession("desktop", &session.Manager{}, statePaths{
|
||||
SettingsPath: configPath,
|
||||
})
|
||||
second.autoSaveRemote = false
|
||||
second.state.AutoSaveRemote = false
|
||||
second.loadSettings()
|
||||
|
||||
if !second.autoSaveRemote {
|
||||
t.Fatal("autoSaveRemote = false, want true after reload")
|
||||
}
|
||||
if !second.state.AutoSaveRemote {
|
||||
t.Fatal("state.AutoSaveRemote = false, want true after reload")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIDebugHeaderBoundsPersistInSettings(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -5714,6 +5741,7 @@ func TestUISaveSecuritySettingsPersistsSyncDefaults(t *testing.T) {
|
||||
u.loadSettingsDraft()
|
||||
u.settingsDraft.Sync.SourceDefault = syncSourceRemote
|
||||
u.settingsDraft.Sync.DirectionDefault = syncDirectionPush
|
||||
u.settingsAutoSaveRemote.Value = true
|
||||
|
||||
if err := u.saveSecuritySettingsAction(); err != nil {
|
||||
t.Fatalf("saveSecuritySettingsAction() error = %v", err)
|
||||
@@ -5730,6 +5758,12 @@ func TestUISaveSecuritySettingsPersistsSyncDefaults(t *testing.T) {
|
||||
if got := reloaded.syncDefaultDirection; got != syncDirectionPush {
|
||||
t.Fatalf("reloaded syncDefaultDirection = %q, want push", got)
|
||||
}
|
||||
if !reloaded.autoSaveRemote {
|
||||
t.Fatal("reloaded autoSaveRemote = false, want true")
|
||||
}
|
||||
if !reloaded.state.AutoSaveRemote {
|
||||
t.Fatal("reloaded state.AutoSaveRemote = false, want true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUISaveSecuritySettingsPersistsDebugHeaderBounds(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user