@@ -42,9 +42,10 @@ vi.mock("electron", () => ({
4242 } ,
4343 systemPreferences : { } ,
4444} ) ) ;
45- vi . mock ( "../install-channel" , ( ) => ( {
45+ // The real `ownsItsUpdates`, so the notice tests follow the channel rule rather than a copy of it.
46+ vi . mock ( "../install-channel" , async ( importOriginal ) => ( {
47+ ...( await importOriginal < typeof import ( "../install-channel" ) > ( ) ) ,
4648 getInstallChannel : ( ) => mocks . channel ,
47- ownsItsUpdates : ( channel : string ) => channel === "nsis" ,
4849} ) ) ;
4950vi . mock ( "../ipc/handlers" , ( ) => ( {
5051 getSelectedDesktopSource : ( ) => null ,
@@ -127,10 +128,10 @@ describe("openscreen mcp usage ping", () => {
127128// The user who only reaches OpenScreen through an agent: the notice the cache holds has to reach
128129// the server it starts, or it is never said.
129130describe ( "openscreen mcp update notice" , ( ) => {
130- function cacheLookup ( latestVersion : string ) {
131+ function cacheLookup ( latestVersion : string , checkedAt = Date . now ( ) ) {
131132 writeFileSync (
132133 path . join ( mocks . userData , "mcp-update-check.json" ) ,
133- JSON . stringify ( { latestVersion, checkedAt : Date . now ( ) } ) ,
134+ JSON . stringify ( { latestVersion, checkedAt } ) ,
134135 ) ;
135136 }
136137
@@ -156,7 +157,8 @@ describe("openscreen mcp update notice", () => {
156157 it ( "says nothing, and looks nothing up, on a Store install" , async ( ) => {
157158 mocks . isPackaged = true ;
158159 mocks . channel = "store" ;
159- cacheLookup ( "9.9.9" ) ;
160+ // Stale, so a lookup started by mistake would reach the network and fail the assertion.
161+ cacheLookup ( "9.9.9" , 0 ) ;
160162 await runMcp ( ) ;
161163 expect ( mocks . serve . mock . calls [ 0 ] [ 0 ] . updateNotice ) . toBeUndefined ( ) ;
162164 expect ( mocks . netFetch ) . not . toHaveBeenCalled ( ) ;
0 commit comments