@@ -28,13 +28,23 @@ jest.mock('../data/hooks', () => ({
2828
2929jest . mock ( '../components/RoleCard' , ( ) => ( {
3030 __esModule : true ,
31- default : ( { title, description, handleDelete } : { title : string ; description : string ; handleDelete : ( ) => void } ) => (
31+ default : ( {
32+ title,
33+ description,
34+ handleDelete,
35+ } : {
36+ title : string ;
37+ description : string ;
38+ handleDelete ?: ( ) => void ;
39+ } ) => (
3240 < div data-testid = "role-card" >
3341 < div > { title } </ div >
3442 < div > { description } </ div >
35- < button type = "button" onClick = { handleDelete } data-testid = { `delete-role-${ title } ` } >
36- Delete
37- </ button >
43+ { handleDelete && (
44+ < button type = "button" onClick = { handleDelete } data-testid = { `delete-role-${ title } ` } >
45+ Delete
46+ </ button >
47+ ) }
3848 </ div >
3949 ) ,
4050} ) ) ;
@@ -91,13 +101,15 @@ describe('LibrariesUserManager', () => {
91101
92102 // Mock team members
93103 ( useTeamMembers as jest . Mock ) . mockReturnValue ( {
94- data : [
95- {
96- username : 'testuser' ,
97- 98- roles : [ 'admin' , 'instructor' ] ,
99- } ,
100- ] ,
104+ data : {
105+ results : [
106+ {
107+ username : 'testuser' ,
108+ 109+ roles : [ 'admin' , 'instructor' ] ,
110+ } ,
111+ ] ,
112+ } ,
101113 isLoading : false ,
102114 isFetching : false ,
103115 } ) ;
@@ -255,13 +267,15 @@ describe('LibrariesUserManager', () => {
255267 const user = userEvent . setup ( ) ;
256268
257269 ( useTeamMembers as jest . Mock ) . mockReturnValue ( {
258- data : [
259- {
260- username : 'testuser' ,
261- 262- roles : [ 'admin' ] ,
263- } ,
264- ] ,
270+ data : {
271+ results : [
272+ {
273+ username : 'testuser' ,
274+ 275+ roles : [ 'admin' ] ,
276+ } ,
277+ ] ,
278+ } ,
265279 isLoading : false ,
266280 isFetching : false ,
267281 } ) ;
0 commit comments