@@ -345,6 +345,11 @@ describe("DesktopUpdates", () => {
345345 const updates = yield * DesktopUpdates . DesktopUpdates ;
346346 yield * updates . configure ;
347347
348+ harness . emit ( "update-available" , {
349+ version : "1.2.4" ,
350+ releaseNotes : "## What's changed\n- fix: queued update" ,
351+ } ) ;
352+ yield * flushCallbacks ;
348353 harness . emit ( "update-downloaded" , { version : "1.2.4" } ) ;
349354 yield * flushCallbacks ;
350355
@@ -357,6 +362,9 @@ describe("DesktopUpdates", () => {
357362 const unchangedState = yield * updates . getState ;
358363 assert . equal ( unchangedState . status , "downloaded" ) ;
359364 assert . equal ( unchangedState . downloadedVersion , "1.2.4" ) ;
365+ assert . deepEqual ( unchangedState . releaseNotes , [
366+ { version : "1.2.4" , items : [ "fix: queued update" ] } ,
367+ ] ) ;
360368
361369 const nextResult = yield * updates . check ( "poll" ) ;
362370 assert . isTrue ( nextResult . checked ) ;
@@ -435,6 +443,27 @@ describe("DesktopUpdates", () => {
435443 ) . pipe ( Effect . provide ( Layer . merge ( TestClock . layer ( ) , harness . layer ) ) ) ;
436444 } ) ;
437445
446+ it . effect ( "preserves a queued installer after a background updater error" , ( ) => {
447+ const harness = makeHarness ( ) ;
448+
449+ return Effect . scoped (
450+ Effect . gen ( function * ( ) {
451+ const updates = yield * DesktopUpdates . DesktopUpdates ;
452+ yield * updates . configure ;
453+ harness . emit ( "update-downloaded" , { version : "1.2.4" } ) ;
454+ yield * flushCallbacks ;
455+
456+ harness . emit ( "error" , new Error ( "background updater failure" ) ) ;
457+ yield * flushCallbacks ;
458+
459+ const state = yield * updates . getState ;
460+ assert . equal ( state . status , "error" ) ;
461+ assert . equal ( state . downloadedVersion , "1.2.4" ) ;
462+ assert . isNull ( state . errorContext ) ;
463+ } ) ,
464+ ) . pipe ( Effect . provide ( Layer . merge ( TestClock . layer ( ) , harness . layer ) ) ) ;
465+ } ) ;
466+
438467 it . effect ( "logs bounded updater failure context without exposing the cause" , ( ) => {
439468 const cause = new Error (
440469 "request failed for https://user:[email protected] /update?token=secret" ,
0 commit comments