fix: correct CertificateUploadDialog tests to provide required key file

This commit is contained in:
GitHub Actions
2026-04-14 20:40:26 +00:00
parent 8090c12556
commit fb8d80f6a3

View File

@@ -121,6 +121,10 @@ describe('CertificateUploadDialog', () => {
// jsdom constraint validation doesn't recognise programmatic file uploads
certInput.required = false
const keyInput = document.getElementById('key-file') as HTMLInputElement
await userEvent.upload(keyInput, new File(['key'], 'key.pem', { type: 'application/x-pem-file' }))
keyInput.required = false
const submitBtn = screen.getByTestId('upload-certificate-submit')
await userEvent.click(submitBtn)
@@ -172,6 +176,10 @@ describe('CertificateUploadDialog', () => {
await userEvent.upload(certInput, createFile())
certInput.required = false
const keyInput = document.getElementById('key-file') as HTMLInputElement
await userEvent.upload(keyInput, new File(['key'], 'key.pem', { type: 'application/x-pem-file' }))
keyInput.required = false
await userEvent.click(screen.getByTestId('upload-certificate-submit'))
expect(toast.success).toHaveBeenCalledWith('certificates.uploadSuccess')
})
@@ -189,6 +197,10 @@ describe('CertificateUploadDialog', () => {
await userEvent.upload(certInput, createFile())
certInput.required = false
const keyInput = document.getElementById('key-file') as HTMLInputElement
await userEvent.upload(keyInput, new File(['key'], 'key.pem', { type: 'application/x-pem-file' }))
keyInput.required = false
await userEvent.click(screen.getByTestId('upload-certificate-submit'))
expect(toast.error).toHaveBeenCalled()
})