diff --git a/frontend/src/components/dialogs/__tests__/CertificateUploadDialog.test.tsx b/frontend/src/components/dialogs/__tests__/CertificateUploadDialog.test.tsx index a1430bfb..bf8b00c7 100644 --- a/frontend/src/components/dialogs/__tests__/CertificateUploadDialog.test.tsx +++ b/frontend/src/components/dialogs/__tests__/CertificateUploadDialog.test.tsx @@ -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() })