fix: Add delete confirmation dialog test for CredentialManager component

This commit is contained in:
GitHub Actions
2026-02-18 18:01:36 +00:00
parent 4f56127147
commit 9d8f39bae0

View File

@@ -301,6 +301,30 @@ describe('CredentialManager', () => {
})
})
it('opens delete confirmation dialog when delete action is clicked', async () => {
const user = userEvent.setup()
renderWithClient(
<CredentialManager
open={true}
onOpenChange={mockOnOpenChange}
provider={mockProvider}
providerTypeInfo={mockProviderTypeInfo}
/>
)
const credentialRow = screen.getByText('Main Zone').closest('tr')
expect(credentialRow).not.toBeNull()
const actionButtons = credentialRow?.querySelectorAll('button')
expect(actionButtons?.[2]).toBeDefined()
await user.click(actionButtons![2])
expect(await screen.findByRole('dialog', { name: 'Delete Credential?' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Delete' })).toBeInTheDocument()
})
// 5. Validation - Required Fields
it('validates required fields on add', async () => {
const user = userEvent.setup()