@@ -21,6 +21,7 @@ vi.mock("@src/i18n/TranslationContext", () => ({
2121				"cloud:remoteControlDescription" :
2222					"Enable following and interacting with tasks in this workspace with Roo Code Cloud" , 
2323				"cloud:profilePicture" : "Profile picture" , 
24+ 				"cloud:cloudUrlPillLabel" : "Roo Code Cloud URL: " , 
2425			} 
2526			return  translations [ key ]  ||  key 
2627		} , 
@@ -148,4 +149,70 @@ describe("CloudView", () => {
148149		expect ( screen . queryByTestId ( "remote-control-toggle" ) ) . not . toBeInTheDocument ( ) 
149150		expect ( screen . queryByText ( "Roomote Control" ) ) . not . toBeInTheDocument ( ) 
150151	} ) 
152+ 
153+ 	it ( "should not display cloud URL pill when pointing to production" ,  ( )  =>  { 
154+ 		const  mockUserInfo  =  { 
155+ 			name : "Test User" , 
156+ 157+ 		} 
158+ 
159+ 		render ( 
160+ 			< CloudView 
161+ 				userInfo = { mockUserInfo } 
162+ 				isAuthenticated = { true } 
163+ 				cloudApiUrl = "https://app.roocode.com" 
164+ 				onDone = { ( )  =>  { } } 
165+ 			/> , 
166+ 		) 
167+ 
168+ 		// Check that the cloud URL pill is NOT displayed for production URL 
169+ 		expect ( screen . queryByText ( / R o o   C o d e   C l o u d   U R L : / ) ) . not . toBeInTheDocument ( ) 
170+ 	} ) 
171+ 
172+ 	it ( "should display cloud URL pill when pointing to non-production environment" ,  ( )  =>  { 
173+ 		const  mockUserInfo  =  { 
174+ 			name : "Test User" , 
175+ 176+ 		} 
177+ 
178+ 		render ( 
179+ 			< CloudView 
180+ 				userInfo = { mockUserInfo } 
181+ 				isAuthenticated = { true } 
182+ 				cloudApiUrl = "https://staging.roocode.com" 
183+ 				onDone = { ( )  =>  { } } 
184+ 			/> , 
185+ 		) 
186+ 
187+ 		// Check that the cloud URL pill is displayed with the staging URL 
188+ 		expect ( screen . getByText ( / R o o   C o d e   C l o u d   U R L : / ) ) . toBeInTheDocument ( ) 
189+ 		expect ( screen . getByText ( "https://staging.roocode.com" ) ) . toBeInTheDocument ( ) 
190+ 	} ) 
191+ 
192+ 	it ( "should display cloud URL pill for non-authenticated users when not pointing to production" ,  ( )  =>  { 
193+ 		render ( 
194+ 			< CloudView 
195+ 				userInfo = { null } 
196+ 				isAuthenticated = { false } 
197+ 				cloudApiUrl = "https://dev.roocode.com" 
198+ 				onDone = { ( )  =>  { } } 
199+ 			/> , 
200+ 		) 
201+ 
202+ 		// Check that the cloud URL pill is displayed even when not authenticated 
203+ 		expect ( screen . getByText ( / R o o   C o d e   C l o u d   U R L : / ) ) . toBeInTheDocument ( ) 
204+ 		expect ( screen . getByText ( "https://dev.roocode.com" ) ) . toBeInTheDocument ( ) 
205+ 	} ) 
206+ 
207+ 	it ( "should not display cloud URL pill when cloudApiUrl is undefined" ,  ( )  =>  { 
208+ 		const  mockUserInfo  =  { 
209+ 			name : "Test User" , 
210+ 211+ 		} 
212+ 
213+ 		render ( < CloudView  userInfo = { mockUserInfo }  isAuthenticated = { true }  onDone = { ( )  =>  { } }  /> ) 
214+ 
215+ 		// Check that the cloud URL pill is NOT displayed when cloudApiUrl is undefined 
216+ 		expect ( screen . queryByText ( / R o o   C o d e   C l o u d   U R L : / ) ) . not . toBeInTheDocument ( ) 
217+ 	} ) 
151218} ) 
0 commit comments