mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 16:19:01 +00:00
fix(vendors): report the filtered total
This commit is contained in:
parent
a6054279a2
commit
ff10bbd8ec
2 changed files with 20 additions and 2 deletions
4
src/app/(protected)/vendors/index.tsx
vendored
4
src/app/(protected)/vendors/index.tsx
vendored
|
|
@ -416,8 +416,8 @@ export default function VendorsListPage() {
|
|||
}}
|
||||
>
|
||||
<Typography variant="body2" sx={{ color: "text.secondary" }}>
|
||||
{rows.length} {isActive ? "active" : "inactive"}{" "}
|
||||
{rows.length === 1 ? "technician" : "technicians"}
|
||||
{totalCount} {isActive ? "active" : "inactive"}{" "}
|
||||
{totalCount === 1 ? "technician" : "technicians"}
|
||||
{(appliedChips.length > 0 || debouncedSearch) && " · filtered"}
|
||||
{` · ${activeCount} active · ${inactiveCount} inactive`}
|
||||
</Typography>
|
||||
|
|
|
|||
|
|
@ -65,4 +65,22 @@ describe("VendorsListPage", () => {
|
|||
expect(screen.getByText("Drain Cleaning Bros")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Deactivate vendor" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("reports the filtered totalCount in the footer when page rows are fewer than total", () => {
|
||||
const pageVendors = Array.from({ length: 3 }, (_, index) => ({
|
||||
...activeVendor,
|
||||
id: 100 + index,
|
||||
companyName: `Vendor ${index + 1}`,
|
||||
}));
|
||||
|
||||
useVendorsList.mockImplementation((params: { isActive?: boolean; pageSize?: number }) => {
|
||||
if (params.pageSize === 1) return result([], params.isActive ? 25 : 0);
|
||||
return result(pageVendors, 25);
|
||||
});
|
||||
|
||||
renderWithProviders(<VendorsListPage />, { route: "/vendors", withAuth: false });
|
||||
|
||||
expect(screen.getByText(/25 active technicians/)).toBeInTheDocument();
|
||||
expect(screen.queryByText(/3 active technicians/)).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue