@@ -110,7 +110,6 @@ describe('main/updater.ts', () => {
110110 } ) ,
111111 ) ;
112112 expect ( autoUpdater . quitAndInstall ) . not . toHaveBeenCalled ( ) ;
113- // Menu state updates invoked
114113 expect ( menuBuilder . setUpdateAvailableMenuVisibility ) . toHaveBeenCalledWith (
115114 false ,
116115 ) ;
@@ -126,7 +125,9 @@ describe('main/updater.ts', () => {
126125 } ) ;
127126
128127 await updater . start ( ) ;
128+
129129 emit ( 'update-downloaded' , { releaseName : 'v9.9.9' } ) ;
130+
130131 // Allow then() of showMessageBox promise to resolve
131132 await Promise . resolve ( ) ;
132133
@@ -137,7 +138,9 @@ describe('main/updater.ts', () => {
137138 describe ( 'update event handlers & scheduling' , ( ) => {
138139 it ( 'skips when app is not packaged' , async ( ) => {
139140 Object . defineProperty ( menubar . app , 'isPackaged' , { value : false } ) ;
141+
140142 await updater . start ( ) ;
143+
141144 expect ( logInfo ) . toHaveBeenCalledWith (
142145 'app updater' ,
143146 'Skipping updater since app is in development mode' ,
@@ -147,7 +150,9 @@ describe('main/updater.ts', () => {
147150
148151 it ( 'handles checking-for-update' , async ( ) => {
149152 await updater . start ( ) ;
153+
150154 emit ( 'checking-for-update' ) ;
155+
151156 expect ( menuBuilder . setCheckForUpdatesMenuEnabled ) . toHaveBeenCalledWith (
152157 false ,
153158 ) ;
@@ -158,7 +163,9 @@ describe('main/updater.ts', () => {
158163
159164 it ( 'handles update-available' , async ( ) => {
160165 await updater . start ( ) ;
166+
161167 emit ( 'update-available' ) ;
168+
162169 expect ( menuBuilder . setUpdateAvailableMenuVisibility ) . toHaveBeenCalledWith (
163170 true ,
164171 ) ;
@@ -169,15 +176,19 @@ describe('main/updater.ts', () => {
169176
170177 it ( 'handles download-progress' , async ( ) => {
171178 await updater . start ( ) ;
179+
172180 emit ( 'download-progress' , { percent : 12.3456 } ) ;
181+
173182 expect ( menubar . tray . setToolTip ) . toHaveBeenCalledWith (
174183 expect . stringContaining ( '12.35%' ) ,
175184 ) ;
176185 } ) ;
177186
178187 it ( 'handles update-not-available' , async ( ) => {
179188 await updater . start ( ) ;
189+
180190 emit ( 'update-not-available' ) ;
191+
181192 expect ( menuBuilder . setCheckForUpdatesMenuEnabled ) . toHaveBeenCalledWith (
182193 true ,
183194 ) ;
@@ -197,9 +208,8 @@ describe('main/updater.ts', () => {
197208 try {
198209 await updater . start ( ) ;
199210
200- menuBuilder . setNoUpdateAvailableMenuVisibility . mockClear ( ) ;
201-
202211 emit ( 'update-not-available' ) ;
212+
203213 // Immediately shows the message
204214 expect (
205215 menuBuilder . setNoUpdateAvailableMenuVisibility ,
@@ -219,16 +229,17 @@ describe('main/updater.ts', () => {
219229 vi . useFakeTimers ( ) ;
220230 try {
221231 await updater . start ( ) ;
222- menuBuilder . setNoUpdateAvailableMenuVisibility . mockClear ( ) ;
223232
224233 emit ( 'update-not-available' ) ;
234+
225235 // Message shown
226236 expect (
227237 menuBuilder . setNoUpdateAvailableMenuVisibility ,
228238 ) . toHaveBeenCalledWith ( true ) ;
229239
230240 // New check should hide immediately and clear pending timeout
231241 emit ( 'checking-for-update' ) ;
242+
232243 expect (
233244 menuBuilder . setNoUpdateAvailableMenuVisibility ,
234245 ) . toHaveBeenLastCalledWith ( false ) ;
@@ -247,7 +258,9 @@ describe('main/updater.ts', () => {
247258
248259 it ( 'handles update-cancelled (reset state)' , async ( ) => {
249260 await updater . start ( ) ;
261+
250262 emit ( 'update-cancelled' ) ;
263+
251264 expect ( menubar . tray . setToolTip ) . toHaveBeenCalledWith ( APPLICATION . NAME ) ;
252265 expect ( menuBuilder . setCheckForUpdatesMenuEnabled ) . toHaveBeenCalledWith (
253266 true ,
@@ -256,8 +269,10 @@ describe('main/updater.ts', () => {
256269
257270 it ( 'handles error (reset + logError)' , async ( ) => {
258271 await updater . start ( ) ;
272+
259273 const err = new Error ( 'failure' ) ;
260274 emit ( 'error' , err ) ;
275+
261276 expect ( logError ) . toHaveBeenCalledWith (
262277 'auto updater' ,
263278 'Error checking for update' ,
@@ -276,6 +291,7 @@ describe('main/updater.ts', () => {
276291 } ) as unknown as typeof setInterval ) ;
277292 try {
278293 await updater . start ( ) ;
294+
279295 // At minimum the initial check should have occurred
280296 const callCount = vi . mocked ( autoUpdater . checkForUpdatesAndNotify ) . mock
281297 . calls . length ;
0 commit comments