fix: correct CertificateUploadDialog tests to provide required key file
This commit is contained in:
@@ -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()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user