The real-group profiles stay as a test, so a change that moves a pick fails. Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { deriveCompactCards } from "../../app/(app)/create/hooks/useFacetRecommendations";
|
|
|
|
describe("deriveCompactCards", () => {
|
|
it("falls back to deck order with no tags when no facets are chosen", () => {
|
|
const result = deriveCompactCards("decisionApproaches", {}, 5);
|
|
expect(result.compactCardIds).toHaveLength(5);
|
|
expect(result.recommendedIds.size).toBe(0);
|
|
expect(result.orderedIds[0]).toBe(result.compactCardIds[0]);
|
|
});
|
|
|
|
it("shows the top five in deck order and leaves every-rule cards untagged", () => {
|
|
const result = deriveCompactCards(
|
|
"decisionApproaches",
|
|
{
|
|
size: "thirteenToOneHundred",
|
|
mainKind: "workersCoop",
|
|
scale: ["local"],
|
|
stage: "established",
|
|
traits: { risky: true, sponsor: true, employer: true },
|
|
},
|
|
5,
|
|
);
|
|
expect(result.compactCardIds).toEqual([
|
|
"decision-speeds",
|
|
"modified-consensus",
|
|
"emergency-decisions",
|
|
"on-site-lead",
|
|
"how-we-are-covered",
|
|
]);
|
|
expect(result.recommendedIds.has("decision-speeds")).toBe(false);
|
|
expect(result.recommendedIds.has("on-site-lead")).toBe(true);
|
|
});
|
|
|
|
it("shows seven when the screen asks for seven, with spending behind see all", () => {
|
|
const result = deriveCompactCards(
|
|
"decisionApproaches",
|
|
{
|
|
size: "thirteenToOneHundred",
|
|
mainKind: "workersCoop",
|
|
scale: ["local"],
|
|
stage: "established",
|
|
traits: { risky: true, sponsor: true, employer: true },
|
|
},
|
|
7,
|
|
);
|
|
expect(result.compactCardIds).toEqual([
|
|
"decision-speeds",
|
|
"modified-consensus",
|
|
"changing-this-rule",
|
|
"emergency-decisions",
|
|
"on-site-lead",
|
|
"how-we-are-covered",
|
|
"elected-board-of-directors",
|
|
]);
|
|
expect(result.orderedIds.slice(7, 10)).toEqual([
|
|
"shared-money",
|
|
"spending-limits",
|
|
"pay-and-hiring",
|
|
]);
|
|
});
|
|
});
|