feat(tests): enhance test coverage and error handling across various components

- Added a test case in CrowdSecConfig to show improved error message when preset is not cached.
- Introduced a new test suite for the Dashboard component, verifying counts and health status.
- Updated SMTPSettings tests to utilize a shared render function and added tests for backend validation errors.
- Modified Security.audit tests to improve input handling and removed redundant export failure test.
- Refactored Security tests to remove export functionality and ensure correct rendering of components.
- Enhanced UsersPage tests with new scenarios for updating user permissions and manual invite link flow.
- Created a new utility for rendering components with a QueryClient and MemoryRouter for better test isolation.
- Updated go-test-coverage script to improve error handling and coverage reporting.
This commit is contained in:
GitHub Actions
2025-12-11 00:26:07 +00:00
parent ca4cfc4e65
commit e299aa6b52
81 changed files with 8960 additions and 450 deletions

View File

@@ -6,10 +6,11 @@ interface SwitchProps extends React.InputHTMLAttributes<HTMLInputElement> {
}
const Switch = React.forwardRef<HTMLInputElement, SwitchProps>(
({ className, onCheckedChange, onChange, ...props }, ref) => {
({ className, onCheckedChange, onChange, id, ...props }, ref) => {
return (
<label className={cn("relative inline-flex items-center cursor-pointer", className)}>
<label htmlFor={id} className={cn("relative inline-flex items-center cursor-pointer", className)}>
<input
id={id}
type="checkbox"
className="sr-only peer"
ref={ref}