@@ -148,4 +148,68 @@ describe("CloudView", () => {
148148 expect ( screen . queryByTestId ( "remote-control-toggle" ) ) . not . toBeInTheDocument ( )
149149 expect ( screen . queryByText ( "Roomote Control" ) ) . not . toBeInTheDocument ( )
150150 } )
151+
152+ it ( "should not display cloud URL pill when pointing to production" , ( ) => {
153+ const mockUserInfo = {
154+ name : "Test User" ,
155+ 156+ }
157+
158+ render (
159+ < AccountView
160+ userInfo = { mockUserInfo }
161+ isAuthenticated = { true }
162+ cloudApiUrl = "https://app.roocode.com"
163+ onDone = { ( ) => { } }
164+ /> ,
165+ )
166+
167+ // Check that the cloud URL pill is NOT displayed for production URL
168+ expect ( screen . queryByText ( / R o o C o d e C l o u d U R L : / ) ) . not . toBeInTheDocument ( )
169+ } )
170+
171+ it ( "should display cloud URL pill when pointing to non-production environment" , ( ) => {
172+ const mockUserInfo = {
173+ name : "Test User" ,
174+ 175+ }
176+
177+ render (
178+ < AccountView
179+ userInfo = { mockUserInfo }
180+ isAuthenticated = { true }
181+ cloudApiUrl = "https://staging.roocode.com"
182+ onDone = { ( ) => { } }
183+ /> ,
184+ )
185+
186+ // Check that the cloud URL pill is displayed with the staging URL
187+ expect ( screen . getByText ( "Roo Code Cloud URL: https://staging.roocode.com" ) ) . toBeInTheDocument ( )
188+ } )
189+
190+ it ( "should display cloud URL pill for non-authenticated users when not pointing to production" , ( ) => {
191+ render (
192+ < AccountView
193+ userInfo = { null }
194+ isAuthenticated = { false }
195+ cloudApiUrl = "https://dev.roocode.com"
196+ onDone = { ( ) => { } }
197+ /> ,
198+ )
199+
200+ // Check that the cloud URL pill is displayed even when not authenticated
201+ expect ( screen . getByText ( "Roo Code Cloud URL: https://dev.roocode.com" ) ) . toBeInTheDocument ( )
202+ } )
203+
204+ it ( "should not display cloud URL pill when cloudApiUrl is undefined" , ( ) => {
205+ const mockUserInfo = {
206+ name : "Test User" ,
207+ 208+ }
209+
210+ render ( < AccountView userInfo = { mockUserInfo } isAuthenticated = { true } onDone = { ( ) => { } } /> )
211+
212+ // Check that the cloud URL pill is NOT displayed when cloudApiUrl is undefined
213+ expect ( screen . queryByText ( / R o o C o d e C l o u d U R L : / ) ) . not . toBeInTheDocument ( )
214+ } )
151215} )
0 commit comments