mirror of
https://github.com/Sea-Haven-Industries/seahaven-ap.git
synced 2026-10-04 18:21:58 +00:00
25 lines
826 B
TypeScript
25 lines
826 B
TypeScript
|
|
import { describe, expect, it } from "vitest";
|
||
|
|
import { countSelectedRows } from "@/dashboard/selection";
|
||
|
|
|
||
|
|
describe("countSelectedRows", () => {
|
||
|
|
const rowIds = ["inv-1", "inv-2", "inv-3"];
|
||
|
|
|
||
|
|
it("counts include selections", () => {
|
||
|
|
expect(countSelectedRows({ type: "include", ids: new Set(["inv-1", "inv-3"]) }, rowIds)).toBe(
|
||
|
|
2,
|
||
|
|
);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("counts exclude select-all with empty exclusions", () => {
|
||
|
|
expect(countSelectedRows({ type: "exclude", ids: new Set() }, rowIds)).toBe(3);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("counts exclude models after deselecting one row", () => {
|
||
|
|
expect(countSelectedRows({ type: "exclude", ids: new Set(["inv-2"]) }, rowIds)).toBe(2);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("returns zero for empty include selection", () => {
|
||
|
|
expect(countSelectedRows({ type: "include", ids: new Set() }, rowIds)).toBe(0);
|
||
|
|
});
|
||
|
|
});
|