File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,37 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => {
275
275
} ) ;
276
276
} ) ;
277
277
278
+ test ( 'Testing Leave Organization button functionality' , async ( ) => {
279
+ setItem ( 'UserImage' , '' ) ;
280
+ setItem ( 'SuperAdmin' , true ) ;
281
+ setItem ( 'FirstName' , 'John' ) ;
282
+ setItem ( 'LastName' , 'Doe' ) ;
283
+
284
+ render (
285
+ < MockedProvider addTypename = { false } link = { link } >
286
+ < BrowserRouter >
287
+ < Provider store = { store } >
288
+ < I18nextProvider i18n = { i18nForTest } >
289
+ < UserSidebarOrg { ...props } hideDrawer = { null } />
290
+ </ I18nextProvider >
291
+ </ Provider >
292
+ </ BrowserRouter >
293
+ </ MockedProvider > ,
294
+ ) ;
295
+
296
+ await wait ( ) ;
297
+
298
+ // Ensure the Leave button is rendered
299
+ const leaveButton = screen . getByTestId ( 'leaveOrgButton' ) ;
300
+ expect ( leaveButton ) . toBeInTheDocument ( ) ;
301
+
302
+ // Simulate clicking the Leave button
303
+ userEvent . click ( leaveButton ) ;
304
+
305
+ // Check if the modal appears
306
+ expect ( screen . getByText ( 'Leaving organization ?' ) ) . toBeInTheDocument ( ) ;
307
+ } ) ;
308
+
278
309
test ( 'Testing Profile Page & Organization Detail Modal' , async ( ) => {
279
310
setItem ( 'UserImage' , '' ) ;
280
311
setItem ( 'SuperAdmin' , true ) ;
Original file line number Diff line number Diff line change @@ -154,6 +154,7 @@ const UserSidebarOrg = ({
154
154
</ button >
155
155
156
156
< button
157
+ data-testid = "leaveOrgButton"
157
158
onClick = { ( ) => {
158
159
setModalShow ( true ) ;
159
160
} }
You can’t perform that action at this time.
0 commit comments