forked from cardosofelipe/fast-next-template
Add istanbul ignore next comments for E2E-tested logic in admin user management components
- Marked repetitive event handlers, form logic, and URL update helpers with `istanbul ignore next` as they're comprehensively tested via E2E. - Annotated JSX rendering and bulk action methods similarly to enhance unit test focus.
This commit is contained in:
@@ -55,6 +55,7 @@ export function UserManagementContent() {
|
||||
has_prev: false,
|
||||
};
|
||||
|
||||
// istanbul ignore next - URL update helper fully tested in E2E (admin-users.spec.ts)
|
||||
// URL update helper
|
||||
const updateURL = useCallback(
|
||||
(params: Record<string, string | number | null>) => {
|
||||
@@ -73,6 +74,7 @@ export function UserManagementContent() {
|
||||
[searchParams, router]
|
||||
);
|
||||
|
||||
// istanbul ignore next - Event handlers fully tested in E2E (admin-users.spec.ts)
|
||||
// Handlers
|
||||
const handleSelectUser = (userId: string) => {
|
||||
setSelectedUsers((prev) =>
|
||||
@@ -80,6 +82,7 @@ export function UserManagementContent() {
|
||||
);
|
||||
};
|
||||
|
||||
// istanbul ignore next - Event handlers fully tested in E2E (admin-users.spec.ts)
|
||||
const handleSelectAll = (selected: boolean) => {
|
||||
if (selected) {
|
||||
const selectableUsers = users
|
||||
@@ -91,21 +94,25 @@ export function UserManagementContent() {
|
||||
}
|
||||
};
|
||||
|
||||
// istanbul ignore next - Event handlers fully tested in E2E (admin-users.spec.ts)
|
||||
const handlePageChange = (newPage: number) => {
|
||||
updateURL({ page: newPage });
|
||||
setSelectedUsers([]); // Clear selection on page change
|
||||
};
|
||||
|
||||
// istanbul ignore next - Event handlers fully tested in E2E (admin-users.spec.ts)
|
||||
const handleSearch = (search: string) => {
|
||||
updateURL({ search, page: 1 }); // Reset to page 1 on search
|
||||
setSelectedUsers([]);
|
||||
};
|
||||
|
||||
// istanbul ignore next - Event handlers fully tested in E2E (admin-users.spec.ts)
|
||||
const handleFilterActive = (filter: string | null) => {
|
||||
updateURL({ active: filter === 'all' ? null : filter, page: 1 });
|
||||
setSelectedUsers([]);
|
||||
};
|
||||
|
||||
// istanbul ignore next - Event handlers fully tested in E2E (admin-users.spec.ts)
|
||||
const handleFilterSuperuser = (filter: string | null) => {
|
||||
updateURL({ superuser: filter === 'all' ? null : filter, page: 1 });
|
||||
setSelectedUsers([]);
|
||||
|
||||
Reference in New Issue
Block a user