This repository was archived by the owner on Aug 6, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
packages/core/src/settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,6 +45,41 @@ describe("deriveUpdateStatus", () => {
4545 } ) ;
4646 } ) ;
4747
48+ it ( "reports an available update with a version" , ( ) => {
49+ expect (
50+ deriveUpdateStatus ( {
51+ checking : false ,
52+ available : true ,
53+ availableVersion : "1.2.3" ,
54+ } ) ,
55+ ) . toEqual ( {
56+ message : "Update 1.2.3 available" ,
57+ type : "success" ,
58+ checking : false ,
59+ } ) ;
60+ } ) ;
61+
62+ it ( "reports an available update without a version" , ( ) => {
63+ expect ( deriveUpdateStatus ( { checking : false , available : true } ) ) . toEqual ( {
64+ message : "Update available" ,
65+ type : "success" ,
66+ checking : false ,
67+ } ) ;
68+ } ) ;
69+
70+ it ( "reports a check error" , ( ) => {
71+ expect (
72+ deriveUpdateStatus ( {
73+ checking : false ,
74+ error : "Update check timed out. Please try again." ,
75+ } ) ,
76+ ) . toEqual ( {
77+ message : "Update check timed out. Please try again." ,
78+ type : "error" ,
79+ checking : false ,
80+ } ) ;
81+ } ) ;
82+
4883 it ( "clears checking when finished with no other signal" , ( ) => {
4984 expect ( deriveUpdateStatus ( { checking : false } ) ) . toEqual ( {
5085 checking : false ,
Original file line number Diff line number Diff line change 11export interface RawUpdateStatus {
22 checking ?: boolean ;
33 downloading ?: boolean ;
4+ available ?: boolean ;
45 upToDate ?: boolean ;
56 updateReady ?: boolean ;
67 version ?: string ;
8+ availableVersion ?: string ;
9+ error ?: string ;
710}
811
912export interface DerivedUpdateStatus {
@@ -34,6 +37,18 @@ export function deriveUpdateStatus(
3437 checking : false ,
3538 } ;
3639 }
40+ if ( status . checking === false && status . available ) {
41+ return {
42+ message : status . availableVersion
43+ ? `Update ${ status . availableVersion } available`
44+ : "Update available" ,
45+ type : "success" ,
46+ checking : false ,
47+ } ;
48+ }
49+ if ( status . checking === false && status . error ) {
50+ return { message : status . error , type : "error" , checking : false } ;
51+ }
3752 if ( status . checking === false ) {
3853 return { checking : false } ;
3954 }
You can’t perform that action at this time.
0 commit comments