Send the invitation as a light letter that names the community, the inviter by email, and who can read the Rule.
This commit is contained in:
1 parent
70ceb73104
commit
727a92a9ac
14 files changed
+534
-26
No files matched your search
@@ -0,0 +1,63 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
clipCommunityInviteDescription,
|
||||
communityInviteInitials,
|
||||
communityPossessive,
|
||||
inviteRuleCountsLabel,
|
||||
} from "../../lib/create/ruleInviteCardMeta";
|
||||
|
||||
describe("communityInviteInitials", () => {
|
||||
it("uses the first two words", () => {
|
||||
expect(communityInviteInitials("Juniper Street Food Share")).toBe("JS");
|
||||
});
|
||||
|
||||
it("uses two letters of a single word", () => {
|
||||
expect(communityInviteInitials("Garden")).toBe("GA");
|
||||
});
|
||||
});
|
||||
|
||||
describe("communityPossessive", () => {
|
||||
it("adds a curly ’s when the name does not end in s", () => {
|
||||
expect(communityPossessive("Juniper Street Food Share")).toBe(
|
||||
"Juniper Street Food Share’s",
|
||||
);
|
||||
});
|
||||
|
||||
it("adds only a curly apostrophe when the name ends in s", () => {
|
||||
expect(communityPossessive("Members")).toBe("Members’");
|
||||
});
|
||||
});
|
||||
|
||||
describe("clipCommunityInviteDescription", () => {
|
||||
it("cuts at 140 characters", () => {
|
||||
const long = "a".repeat(160);
|
||||
expect(clipCommunityInviteDescription(long)).toHaveLength(140);
|
||||
});
|
||||
});
|
||||
|
||||
describe("inviteRuleCountsLabel", () => {
|
||||
it("counts values and other cards, not shared terms", () => {
|
||||
expect(
|
||||
inviteRuleCountsLabel({
|
||||
sections: [
|
||||
{
|
||||
categoryName: "Values",
|
||||
entries: [
|
||||
{ title: "Care", body: "We care." },
|
||||
{ title: "Share", body: "We share." },
|
||||
{ title: "Listen", body: "We listen." },
|
||||
],
|
||||
},
|
||||
{
|
||||
categoryName: "Communication",
|
||||
entries: [{ title: "Open channel", body: "We talk in the hall." }],
|
||||
},
|
||||
{
|
||||
categoryName: "Membership",
|
||||
entries: [{ title: "Open admission", body: "Anyone who shares the work." }],
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toBe("3 VALUES AND 2 CARDS");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user