Export is PDF, RULE.md, and Print on US Letter, with every shared term, no member names, and a takeaway that points at Ask an organizer. Finished Rules keep type and place so the team can read folded counts without a database, Umami can sit beside the app with no cookies, and the person who holds the pen gets working PDF and RULE.md links 48 hours later.
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { aggregateRuleLaunchCounts } from "../../lib/server/ruleLaunchCounts";
|
|
|
|
describe("aggregateRuleLaunchCounts", () => {
|
|
it("folds cells under five and reports Rules finished", () => {
|
|
const rows = [
|
|
...Array.from({ length: 5 }, () => ({
|
|
orgType: "mutualAid",
|
|
place: "Boulder",
|
|
})),
|
|
...Array.from({ length: 5 }, () => ({
|
|
orgType: "mutualAid",
|
|
place: "boulder",
|
|
})),
|
|
{ orgType: "nonprofit", place: "Denver" },
|
|
{ orgType: "workersCoop", place: "Oakland" },
|
|
];
|
|
const counts = aggregateRuleLaunchCounts(rows);
|
|
expect(counts.finished).toBe(12);
|
|
expect(counts.cells).toEqual([
|
|
{
|
|
orgType: "mutualAid",
|
|
place: "Boulder",
|
|
count: 10,
|
|
folded: false,
|
|
},
|
|
{
|
|
orgType: null,
|
|
place: null,
|
|
count: 2,
|
|
folded: true,
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("returns no cells when nothing is finished", () => {
|
|
expect(aggregateRuleLaunchCounts([])).toEqual({ finished: 0, cells: [] });
|
|
});
|
|
});
|