From fb8d80f6a386b400befb435f306f0d8a53cacd58 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 14 Apr 2026 20:40:26 +0000 Subject: [PATCH] fix: correct CertificateUploadDialog tests to provide required key file --- .../__tests__/CertificateUploadDialog.test.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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() })