@@ -184,6 +184,72 @@ describe("CloudService", () => {
184184 expect ( mockAuthService . getUserInfo ) . toHaveBeenCalled ( )
185185 } )
186186
187+ it ( "should return organization ID from user info" , ( ) => {
188+ const mockUserInfo = {
189+ name : "Test User" ,
190+ 191+ organizationId : "org_123" ,
192+ organizationName : "Test Org" ,
193+ organizationRole : "admin" ,
194+ }
195+ mockAuthService . getUserInfo . mockReturnValue ( mockUserInfo )
196+
197+ const result = cloudService . getOrganizationId ( )
198+ expect ( mockAuthService . getUserInfo ) . toHaveBeenCalled ( )
199+ expect ( result ) . toBe ( "org_123" )
200+ } )
201+
202+ it ( "should return null when no organization ID available" , ( ) => {
203+ mockAuthService . getUserInfo . mockReturnValue ( null )
204+
205+ const result = cloudService . getOrganizationId ( )
206+ expect ( result ) . toBe ( null )
207+ } )
208+
209+ it ( "should return organization name from user info" , ( ) => {
210+ const mockUserInfo = {
211+ name : "Test User" ,
212+ 213+ organizationId : "org_123" ,
214+ organizationName : "Test Org" ,
215+ organizationRole : "admin" ,
216+ }
217+ mockAuthService . getUserInfo . mockReturnValue ( mockUserInfo )
218+
219+ const result = cloudService . getOrganizationName ( )
220+ expect ( mockAuthService . getUserInfo ) . toHaveBeenCalled ( )
221+ expect ( result ) . toBe ( "Test Org" )
222+ } )
223+
224+ it ( "should return null when no organization name available" , ( ) => {
225+ mockAuthService . getUserInfo . mockReturnValue ( null )
226+
227+ const result = cloudService . getOrganizationName ( )
228+ expect ( result ) . toBe ( null )
229+ } )
230+
231+ it ( "should return organization role from user info" , ( ) => {
232+ const mockUserInfo = {
233+ name : "Test User" ,
234+ 235+ organizationId : "org_123" ,
236+ organizationName : "Test Org" ,
237+ organizationRole : "admin" ,
238+ }
239+ mockAuthService . getUserInfo . mockReturnValue ( mockUserInfo )
240+
241+ const result = cloudService . getOrganizationRole ( )
242+ expect ( mockAuthService . getUserInfo ) . toHaveBeenCalled ( )
243+ expect ( result ) . toBe ( "admin" )
244+ } )
245+
246+ it ( "should return null when no organization role available" , ( ) => {
247+ mockAuthService . getUserInfo . mockReturnValue ( null )
248+
249+ const result = cloudService . getOrganizationRole ( )
250+ expect ( result ) . toBe ( null )
251+ } )
252+
187253 it ( "should delegate getAuthState to AuthService" , ( ) => {
188254 const result = cloudService . getAuthState ( )
189255 expect ( mockAuthService . getState ) . toHaveBeenCalled ( )
0 commit comments