test: update common name display test to match exact text

This commit is contained in:
GitHub Actions
2026-04-13 04:38:26 +00:00
parent 3b4fa064d6
commit 850550c5da
2 changed files with 11 additions and 5 deletions

View File

@@ -104,7 +104,7 @@ describe('CertificateDetailDialog', () => {
it('displays common name', () => {
renderDialog()
const matches = screen.getAllByText(/app\.example\.com/)
const matches = screen.getAllByText(/^app\.example\.com$/)
expect(matches.length).toBeGreaterThanOrEqual(1)
})
@@ -161,6 +161,7 @@ describe('CertificateDetailDialog', () => {
vi.mocked(useCertificateDetail).mockReturnValue({
detail: undefined as unknown as CertificateDetail,
isLoading: true,
error: null,
})
renderDialog()
expect(screen.getByTestId('certificate-detail-dialog')).toBeTruthy()
@@ -189,6 +190,7 @@ describe('CertificateDetailDialog', () => {
vi.mocked(useCertificateDetail).mockReturnValue({
detail: sparseDetail,
isLoading: false,
error: null,
})
renderDialog()
const dashes = screen.getAllByText('-')
@@ -204,6 +206,7 @@ describe('CertificateDetailDialog', () => {
vi.mocked(useCertificateDetail).mockReturnValue({
detail: noHostDetail,
isLoading: false,
error: null,
})
renderDialog()
expect(screen.getByText('certificates.noAssignedHosts')).toBeTruthy()
@@ -217,6 +220,7 @@ describe('CertificateDetailDialog', () => {
vi.mocked(useCertificateDetail).mockReturnValue({
detail: autoRenewDetail,
isLoading: false,
error: null,
})
renderDialog()
expect(screen.getByText('common.yes')).toBeTruthy()
@@ -231,6 +235,7 @@ describe('CertificateDetailDialog', () => {
vi.mocked(useCertificateDetail).mockReturnValue({
detail: noOrgDetail,
isLoading: false,
error: null,
})
renderDialog()
expect(screen.getByText('Fallback Issuer')).toBeTruthy()
@@ -240,6 +245,7 @@ describe('CertificateDetailDialog', () => {
vi.mocked(useCertificateDetail).mockReturnValue({
detail: undefined as unknown as CertificateDetail,
isLoading: false,
error: null,
})
renderDialog(null)
expect(screen.queryByText('My Cert')).toBeFalsy()

View File

@@ -175,8 +175,8 @@ describe('CertificateExportDialog', () => {
const fakeBlob = new Blob(['cert-data'], { type: 'application/x-pem-file' })
const revokeURL = vi.fn()
const createURL = vi.fn(() => 'blob:http://localhost/fake')
global.URL.createObjectURL = createURL
global.URL.revokeObjectURL = revokeURL
globalThis.URL.createObjectURL = createURL
globalThis.URL.revokeObjectURL = revokeURL
const appendSpy = vi.spyOn(document.body, 'appendChild')
const removeSpy = vi.fn()
@@ -251,8 +251,8 @@ describe('CertificateExportDialog', () => {
it('uses certificate name in download filename on success', async () => {
const fakeBlob = new Blob(['data'])
global.URL.createObjectURL = vi.fn(() => 'blob:fake')
global.URL.revokeObjectURL = vi.fn()
globalThis.URL.createObjectURL = vi.fn(() => 'blob:fake')
globalThis.URL.revokeObjectURL = vi.fn()
let capturedAnchor: HTMLAnchorElement | null = null
exportMutateFn.mockImplementation(