@@ -9,6 +9,7 @@ function workspaceState(overrides: Partial<WorkspaceState> = {}): WorkspaceState
99 hasConnections : true ,
1010 hasLoadedShellSnapshot : true ,
1111 hasPendingShellSnapshot : false ,
12+ hasSyncingConnectedEnvironment : false ,
1213 hasReadyEnvironment : true ,
1314 hasConnectingEnvironment : false ,
1415 connectingEnvironments : [ ] ,
@@ -25,6 +26,66 @@ describe("workspace connection status", () => {
2526 expect ( workspaceConnectionStatusPresentation ( workspaceState ( ) ) ) . toBeNull ( ) ;
2627 } ) ;
2728
29+ it . each ( [
30+ [ "connecting" , null ] ,
31+ [ "reconnecting" , null ] ,
32+ [ "connecting" , "Could not reach sleeping laptop" ] ,
33+ [ "reconnecting" , "Could not reach sleeping laptop" ] ,
34+ [ "error" , "Could not reach sleeping laptop" ] ,
35+ ] as const ) (
36+ "keeps the brand while a secondary environment is %s (%s)" ,
37+ ( connectionState , connectionError ) => {
38+ const state = workspaceState ( {
39+ hasConnectingEnvironment : connectionState !== "error" ,
40+ hasPendingShellSnapshot : true ,
41+ connectionError,
42+ connectingEnvironments :
43+ connectionState === "error"
44+ ? [ ]
45+ : [
46+ {
47+ environmentId : "environment-2" as never ,
48+ environmentLabel : "Sleeping laptop" ,
49+ displayUrl : "" ,
50+ isRelayManaged : false ,
51+ isEnabled : true ,
52+ connectionState,
53+ connectionError,
54+ connectionErrorTraceId : null ,
55+ } ,
56+ ] ,
57+ } ) ;
58+
59+ expect ( workspaceConnectionStatusPresentation ( state ) ) . toBeNull ( ) ;
60+ } ,
61+ ) ;
62+
63+ it ( "shows connected shell catch-up even while a secondary environment is unreachable" , ( ) => {
64+ const state = workspaceState ( {
65+ hasSyncingConnectedEnvironment : true ,
66+ hasPendingShellSnapshot : true ,
67+ hasConnectingEnvironment : true ,
68+ connectionError : "Could not reach sleeping laptop" ,
69+ connectingEnvironments : [
70+ {
71+ environmentId : "environment-2" as never ,
72+ environmentLabel : "Sleeping laptop" ,
73+ displayUrl : "" ,
74+ isRelayManaged : false ,
75+ isEnabled : true ,
76+ connectionState : "reconnecting" ,
77+ connectionError : "Could not reach sleeping laptop" ,
78+ connectionErrorTraceId : null ,
79+ } ,
80+ ] ,
81+ } ) ;
82+
83+ expect ( workspaceConnectionStatusPresentation ( state ) ) . toEqual ( {
84+ label : "Syncing threads..." ,
85+ showsProgress : true ,
86+ } ) ;
87+ } ) ;
88+
2889 it ( "surfaces offline snapshots" , ( ) => {
2990 const state = workspaceState ( { networkStatus : "offline" , hasReadyEnvironment : false } ) ;
3091
@@ -72,7 +133,10 @@ describe("workspace connection status", () => {
72133 } ) ;
73134
74135 it ( "shows shell catch-up while cached threads remain visible" , ( ) => {
75- const state = workspaceState ( { hasPendingShellSnapshot : true } ) ;
136+ const state = workspaceState ( {
137+ hasPendingShellSnapshot : true ,
138+ hasSyncingConnectedEnvironment : true ,
139+ } ) ;
76140
77141 expect ( workspaceConnectionStatusPresentation ( state ) ) . toEqual ( {
78142 label : "Syncing threads..." ,
@@ -84,6 +148,7 @@ describe("workspace connection status", () => {
84148 const state = workspaceState ( {
85149 hasLoadedShellSnapshot : false ,
86150 hasPendingShellSnapshot : true ,
151+ hasSyncingConnectedEnvironment : true ,
87152 } ) ;
88153
89154 expect ( workspaceConnectionStatusPresentation ( state ) ) . toEqual ( {
0 commit comments