@@ -119,6 +119,7 @@ describe('ApiKeysPage Component', () => {
119119 setupMocks ( { data : null , loading : true } )
120120 render ( < ApiKeysPage /> )
121121 expect ( screen . queryByText ( 'API Key Management' ) ) . not . toBeInTheDocument ( )
122+ // Note: Using direct DOM query as skeleton components don't have semantic roles
122123 expect ( document . querySelectorAll ( '.animate-pulse' ) . length ) . toBeGreaterThan ( 0 )
123124 } )
124125
@@ -253,8 +254,9 @@ describe('ApiKeysPage Component', () => {
253254 describe ( 'API Key Revocation' , ( ) => {
254255 test ( 'revokes API key after confirmation' , async ( ) => {
255256 render ( < ApiKeysPage /> )
256- const row = ( await screen . findByText ( 'mock key 1' ) ) . closest ( 'tr' ) !
257- fireEvent . click ( within ( row ) . getByRole ( 'button' ) )
257+ const row = ( await screen . findByText ( 'mock key 1' ) ) . closest ( 'tr' )
258+ expect ( row ) . not . toBeNull ( )
259+ fireEvent . click ( within ( row ! ) . getByRole ( 'button' ) )
258260
259261 const dialog = await screen . findByRole ( 'dialog' )
260262 expect ( within ( dialog ) . getByText ( / A r e y o u s u r e y o u w a n t t o r e v o k e / ) ) . toBeInTheDocument ( )
@@ -267,8 +269,9 @@ describe('ApiKeysPage Component', () => {
267269
268270 test ( 'cancels revocation when cancel button is clicked' , async ( ) => {
269271 render ( < ApiKeysPage /> )
270- const row = ( await screen . findByText ( 'mock key 1' ) ) . closest ( 'tr' ) !
271- fireEvent . click ( within ( row ) . getByRole ( 'button' ) )
272+ const row = ( await screen . findByText ( 'mock key 1' ) ) . closest ( 'tr' )
273+ expect ( row ) . not . toBeNull ( )
274+ fireEvent . click ( within ( row ! ) . getByRole ( 'button' ) )
272275
273276 const dialog = await screen . findByRole ( 'dialog' )
274277 fireEvent . click ( within ( dialog ) . getByRole ( 'button' , { name : / C a n c e l / i } ) )
@@ -322,6 +325,15 @@ describe('ApiKeysPage Component', () => {
322325 { loading : true } ,
323326 ]
324327 }
328+ if ( mutation === RevokeApiKeyDocument ) {
329+ return [
330+ createMutationFn (
331+ mockRevokeMutation ,
332+ options as { onCompleted ?: ( data : unknown ) => void }
333+ ) ,
334+ { loading : false } ,
335+ ]
336+ }
325337 return [ jest . fn ( ) , { loading : false } ]
326338 }
327339 mockUseMutation . mockImplementation ( createLoadingMutation )
0 commit comments