@@ -184,35 +184,24 @@ describe('ApiNewToken', () => {
184184 render ( < ApiNewToken /> ) ;
185185 renderGlobalModal ( ) ;
186186
187- const selectByValue = ( name : string , value : string ) =>
188- selectEvent . select ( screen . getByRole ( 'textbox' , { name} ) , value ) ;
189-
190- await selectByValue ( 'Project' , 'Read' ) ;
187+ await selectEvent . select ( screen . getByRole ( 'textbox' , { name : 'Project' } ) , 'Read' ) ;
191188
192189 const createButton = screen . getByRole ( 'button' , { name : 'Create Token' } ) ;
193190 expect ( createButton ) . toBeEnabled ( ) ;
194191
195192 await userEvent . click ( createButton ) ;
196193
197- // Wait for the modal to appear (confirms mutation succeeded)
198194 expect ( await screen . findByLabelText ( 'Generated token' ) ) . toBeInTheDocument ( ) ;
199-
200- // Button should be disabled after successful creation
201195 expect ( createButton ) . toBeDisabled ( ) ;
202196 } ) ;
203197
204198 it ( 'displays permissions preview when scopes are selected' , async ( ) => {
205199 render ( < ApiNewToken /> ) ;
206200
207- const selectByValue = ( name : string , value : string ) =>
208- selectEvent . select ( screen . getByRole ( 'textbox' , { name} ) , value ) ;
209-
210- await selectByValue ( 'Project' , 'Read' ) ;
211-
201+ await selectEvent . select ( screen . getByRole ( 'textbox' , { name : 'Project' } ) , 'Read' ) ;
212202 expect ( screen . getByText ( / p r o j e c t : r e a d / ) ) . toBeInTheDocument ( ) ;
213203
214- await selectByValue ( 'Team' , 'Admin' ) ;
215-
204+ await selectEvent . select ( screen . getByRole ( 'textbox' , { name : 'Team' } ) , 'Admin' ) ;
216205 expect ( screen . getByText ( / t e a m : a d m i n / ) ) . toBeInTheDocument ( ) ;
217206 } ) ;
218207
0 commit comments