Show invited people the Rule, let them copy its cards for their community, and replace an expired invitation link.

This commit is contained in:
adilallo committed 2026-11-06 09:16:06 -07:00
1 parent 727a92a9ac
commit 3c984e00c5
37 files changed
+1962 -19

No files matched your search

+78
View File
@@ -0,0 +1,78 @@
import { describe, expect, it } from "vitest";
import {
findCopiedNameHit,
stripCopiedRuleDocument,
} from "../../lib/create/copiedRuleDocument";
describe("stripCopiedRuleDocument", () => {
it("drops name, description, photo, and save-email", () => {
const out = stripCopiedRuleDocument({
title: "Juniper Street Food Share",
communityContext: "A neighborhood share.",
communityAvatarUrl: "https://example.test/a.png",
communityAvatarFileName: "a.png",
communityLocation: "Boulder",
communitySaveEmail: "a@example.com",
sections: [
{
categoryName: "Values",
entries: [{ title: "Care", body: "We care." }],
},
],
});
expect(out.title).toBeUndefined();
expect(out.communityContext).toBeUndefined();
expect(out.communityAvatarUrl).toBeUndefined();
expect(out.communityAvatarFileName).toBeUndefined();
expect(out.communityLocation).toBeUndefined();
expect(out.communitySaveEmail).toBeUndefined();
expect(out.sections).toEqual([
{
categoryName: "Values",
entries: [{ title: "Care", body: "We care." }],
},
]);
});
});
describe("findCopiedNameHit", () => {
it("returns the first entry that still names the original group", () => {
expect(
findCopiedNameHit(
{
sections: [
{
categoryName: "Values",
entries: [
{
title: "Solidarity",
body: "Juniper Street Food Share members share food.",
},
],
},
],
},
"Juniper Street Food Share",
),
).toEqual({
categoryName: "Values",
entryTitle: "Solidarity",
});
});
it("returns null when the name is gone", () => {
expect(
findCopiedNameHit(
{
sections: [
{
categoryName: "Values",
entries: [{ title: "Care", body: "We care." }],
},
],
},
"Juniper Street Food Share",
),
).toBeNull();
});
});