Files
community-rule/tests/unit/formatRecommendationWhyLine.test.ts

37 lines
1.0 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { formatRecommendationWhyLine } from "../../lib/create/formatRecommendationWhyLine";
import type { GroupAnswers } from "../../lib/create/deckTypes";
import messages from "../../messages/en/index";
const copy = messages.create.customRule.recommendations;
const emptyAnswers: GroupAnswers = {
size: null,
mainKind: null,
otherKinds: [],
scale: [],
stage: null,
traits: {},
};
describe("formatRecommendationWhyLine", () => {
it("builds a fit line from kind and size", () => {
expect(
formatRecommendationWhyLine(
{ kind: "fit", matched: ["kind"] },
{ ...emptyAnswers, mainKind: "workersCoop", size: "sixToTwelve" },
copy,
),
).toBe("Fits a worker co-op of 6 to 12 people");
});
it("builds an added line from the setup answer", () => {
expect(
formatRecommendationWhyLine(
{ kind: "added", answer: "employer" },
emptyAnswers,
copy,
),
).toBe("Added because you said you pay some people to do your work");
});
});