@@ -14,15 +14,13 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
1414import { readSeen } from "./appHistory.js" ;
1515import {
1616 AGENT_HANDOFF_FILE ,
17- HANDOFF_READY ,
1817 agentSession ,
1918 desktopHint ,
2019 desktopInstalled ,
2120 openCommandFor ,
2221 openInDesktop ,
2322} from "./desktopApp.js" ;
2423
25- // The live path (ready) is what ships once the app takes handed-over folders; CI exercises it here.
2624const LIVE = { ready : true , platform : "darwin" as const , env : { } , installed : ( ) => true } ;
2725const MAC_DOWNLOAD = "https://hyperframes.dev/studio/download?src=cli" ;
2826const MAC_HINT = `Keep editing by chatting with Framey in the HyperFrames desktop app → ${ MAC_DOWNLOAD } ` ;
@@ -33,15 +31,41 @@ const never = () => {
3331
3432describe ( "openInDesktop" , ( ) => {
3533 it ( "opens and writes nothing while the app cannot take a project" , ( ) => {
36- // Only the Mac app reads a handed-over folder in a released build so far.
37- expect ( HANDOFF_READY ) . toBe ( process . platform === "darwin" ) ;
3834 expect ( openInDesktop ( FILM , { ready : false , platform : "darwin" , open : never } ) ) . toEqual ( {
3935 opened : false ,
4036 reason : "handoff-unavailable" ,
4137 downloadUrl : MAC_DOWNLOAD ,
4238 } ) ;
4339 } ) ;
4440
41+ it ( "hands the folder to the Windows app on its command line, with no override" , ( ) => {
42+ const launched : string [ ] = [ ] ;
43+ const result = openInDesktop ( FILM , {
44+ platform : "win32" ,
45+ env : { LOCALAPPDATA : "C:\\Users\\a\\AppData\\Local" } ,
46+ exists : ( ) => true ,
47+ launch : ( executable , dir ) => ( launched . push ( `${ executable } ${ dir } ` ) , true ) ,
48+ } ) ;
49+ expect ( result ) . toMatchObject ( { opened : true , app : "the HyperFrames desktop app" } ) ;
50+ expect ( launched ) . toEqual ( [
51+ `C:\\Users\\a\\AppData\\Local\\Programs\\HyperFrames\\HyperFrames.exe ${ FILM } ` ,
52+ ] ) ;
53+ } ) ;
54+
55+ it ( "hands the folder to the Linux AppImage on its command line, with no override" , ( ) => {
56+ const launched : string [ ] = [ ] ;
57+ const result = openInDesktop ( FILM , {
58+ platform : "linux" ,
59+ env : { } ,
60+ home : "/home/a" ,
61+ exists : ( ) => true ,
62+ read : ( ) => JSON . stringify ( { appImage : "/opt/HyperFrames.AppImage" } ) ,
63+ launch : ( executable , dir ) => ( launched . push ( `${ executable } ${ dir } ` ) , true ) ,
64+ } ) ;
65+ expect ( result ) . toMatchObject ( { opened : true , app : "the HyperFrames desktop app" } ) ;
66+ expect ( launched ) . toEqual ( [ `/opt/HyperFrames.AppImage ${ FILM } ` ] ) ;
67+ } ) ;
68+
4569 it ( "hands the folder to the released app when it is installed" , ( ) => {
4670 const asked : string [ ] = [ ] ;
4771 const result = openInDesktop ( FILM , {
0 commit comments