feat: Improve type safety in security API calls and update test cases for SSL badge rendering
This commit is contained in:
@@ -490,11 +490,9 @@ describe('ProxyHosts - Coverage enhancements', () => {
|
||||
const stagingBadge = screen.getByText(/SSL \(Staging\)/)
|
||||
expect(stagingBadge).toBeTruthy()
|
||||
|
||||
// Let's Encrypt check has 'Let's Encrypt ✓' and Auto
|
||||
expect(screen.getByText('Lets')).toBeTruthy()
|
||||
expect(screen.getByText("Let's Encrypt ✓")).toBeTruthy()
|
||||
expect(screen.getByText('Auto')).toBeTruthy()
|
||||
expect(screen.getByText("Let's Encrypt (Auto)")).toBeTruthy()
|
||||
// SSL badges are shown (Let's Encrypt text removed for better spacing)
|
||||
const sslBadges = screen.getAllByText('SSL')
|
||||
expect(sslBadges.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('renders multiple domains and websocket label', async () => {
|
||||
|
||||
@@ -112,7 +112,7 @@ describe('ProxyHosts page extra tests', () => {
|
||||
confirmMock.mockRestore()
|
||||
})
|
||||
|
||||
it("renders Let's Encrypt ✓ and Let's Encrypt (Auto) for SSL info", async () => {
|
||||
it('renders SSL badges for SSL-enabled hosts', async () => {
|
||||
const hostValid = sampleHost({ uuid: 'v1', name: 'ValidHost', domain_names: 'valid.example.com', ssl_forced: true })
|
||||
const hostAuto = sampleHost({ uuid: 'a1', name: 'AutoHost', domain_names: 'auto.example.com', ssl_forced: true })
|
||||
|
||||
@@ -125,8 +125,9 @@ describe('ProxyHosts page extra tests', () => {
|
||||
renderWithProviders(<ProxyHosts />)
|
||||
|
||||
await waitFor(() => expect(screen.getByText('ValidHost')).toBeInTheDocument())
|
||||
expect(screen.getByText("Let's Encrypt ✓")).toBeInTheDocument()
|
||||
expect(screen.getByText("Let's Encrypt (Auto)")).toBeInTheDocument()
|
||||
// Check that SSL badges are rendered (text removed for better spacing)
|
||||
const sslBadges = screen.getAllByText('SSL')
|
||||
expect(sslBadges.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('shows error banner when hook returns an error', async () => {
|
||||
|
||||
@@ -42,7 +42,7 @@ const mockRuleSets: RuleSetsResponse = {
|
||||
{ id: 2, uuid: 'uuid-2', name: 'Custom Rules', source_url: '', mode: 'detection', last_updated: '', content: '' },
|
||||
],
|
||||
}
|
||||
|
||||
// Types already imported at top-level; avoid duplicate declarations
|
||||
describe('Security page', () => {
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks()
|
||||
|
||||
Reference in New Issue
Block a user