File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
apps/desktop/src/lib/updater Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,24 @@ describe('Updater', () => {
106
106
}
107
107
unsubscribe ( ) ;
108
108
} ) ;
109
+
110
+ test ( 'should respect disableAutoChecks setting' , async ( ) => {
111
+ const mock = vi . spyOn ( backend , 'checkUpdate' ) . mockReturnValue ( mockUpdate ( null ) ) ;
112
+
113
+ // Set disableAutoChecks to true
114
+ updater . disableAutoChecks . set ( true ) ;
115
+
116
+ // Try to check for updates (should be skipped when disabled)
117
+ await updater . checkForUpdate ( ) ;
118
+ expect ( mock ) . not . toHaveBeenCalled ( ) ;
119
+
120
+ // Set disableAutoChecks to false
121
+ updater . disableAutoChecks . set ( false ) ;
122
+
123
+ // Try to check for updates (should work when enabled)
124
+ await updater . checkForUpdate ( ) ;
125
+ expect ( mock ) . toHaveBeenCalledOnce ( ) ;
126
+ } ) ;
109
127
} ) ;
110
128
111
129
async function mockUpdate ( update : Partial < Update > | null ) : Promise < Update | null > {
Original file line number Diff line number Diff line change 1
1
import { showToast } from '$lib/notifications/toasts' ;
2
2
import { InjectionToken } from '@gitbutler/core/context' ;
3
+ import { persisted } from '@gitbutler/shared/persisted' ;
3
4
import { get , writable } from 'svelte/store' ;
4
5
import type { PostHogWrapper } from '$lib/analytics/posthog' ;
5
6
import type {
@@ -46,7 +47,7 @@ export const UPDATE_INTERVAL_MS = 3600000; // Hourly
46
47
* ./scripts/release.sh --channel nightly --version "0.5.678"
47
48
*/
48
49
export class UpdaterService {
49
- readonly disableAutoChecks = writable ( false ) ;
50
+ readonly disableAutoChecks = persisted ( false , 'disableAutoUpdateChecks' ) ;
50
51
readonly loading = writable ( false ) ;
51
52
readonly update = writable < UpdateStatus > ( { } , ( ) => {
52
53
this . start ( ) ;
You can’t perform that action at this time.
0 commit comments