chore: enhance ACL handling in dropdowns and add emergency token flows

- Add tests to normalize string numeric ACL IDs in AccessListSelector.
- Implement regression tests for ProxyHostForm to ensure numeric ACL values are submitted correctly.
- Introduce a recovery function for ACL lockout scenarios in auth setup.
- Create new tests for ACL creation and security header profiles to ensure dropdown coverage.
- Add regression tests for ACL and Security Headers dropdown behavior in ProxyHostForm.
- Establish a security shard setup to validate emergency token configurations and reset security states.
- Enhance emergency operations tests to ensure ACL selections persist across create/edit flows.
This commit is contained in:
GitHub Actions
2026-02-28 04:41:00 +00:00
parent 2024ad1373
commit 5c4a558486
11 changed files with 795 additions and 422 deletions
@@ -614,4 +614,53 @@ describe('ProxyHostForm Dropdown Change Bug Fix', () => {
expect(mockOnSubmit).toHaveBeenCalled()
})
})
it('submits numeric ACL value when ACL option id is a numeric string', async () => {
const user = userEvent.setup()
const Wrapper = createWrapper()
const stringIdAccessLists = [
{
...mockAccessLists[0],
id: '2',
uuid: 'acl-string-id-2',
name: 'String ID ACL',
},
]
vi.mocked(useAccessLists).mockReturnValue({
data: stringIdAccessLists as unknown as AccessList[],
isLoading: false,
error: null,
} as unknown as ReturnType<typeof useAccessLists>)
render(
<Wrapper>
<ProxyHostForm onSubmit={mockOnSubmit} onCancel={mockOnCancel} />
</Wrapper>
)
await user.type(screen.getByLabelText(/^Name/), 'String ID ACL Host')
await user.type(screen.getByLabelText(/Domain Names/), 'test.com')
await user.type(screen.getByLabelText(/^Host$/), 'localhost')
await user.clear(screen.getByLabelText(/^Port$/))
await user.type(screen.getByLabelText(/^Port$/), '8080')
await user.click(screen.getByRole('combobox', { name: /Access Control List/i }))
await user.click(await screen.findByRole('option', { name: /String ID ACL/i }))
await user.click(screen.getByRole('combobox', { name: /Security Headers/i }))
await user.click(await screen.findByRole('option', { name: /Basic Security/i }))
await user.click(screen.getByRole('button', { name: /Save/i }))
await waitFor(() => {
expect(mockOnSubmit).toHaveBeenCalledWith(
expect.objectContaining({
access_list_id: 2,
security_header_profile_id: 1,
})
)
})
})
})