Replace the Four Pillars page with the Guide to CommunityRule on the Content page Template.
This commit is contained in:
1 parent
bf9ee79c9f
commit
453139c783
17 files changed
+1005
-32
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import messages from "../../messages/en/index";
|
||||
import {
|
||||
collectHowItWorksGuideText,
|
||||
formatHowItWorksByline,
|
||||
formatHowItWorksDate,
|
||||
howItWorksReadMinutes,
|
||||
howItWorksWikiMarkdown,
|
||||
} from "../../lib/howItWorksGuide";
|
||||
|
||||
describe("howItWorksGuide", () => {
|
||||
const page = messages.pages.howItWorks;
|
||||
|
||||
it("formats the Figma date and byline from the final text", () => {
|
||||
expect(formatHowItWorksDate(page.banner.date)).toBe("18 February 2027");
|
||||
const minutes = howItWorksReadMinutes(page);
|
||||
expect(minutes).toBeGreaterThanOrEqual(10);
|
||||
expect(formatHowItWorksByline(page, minutes)).toBe(
|
||||
`By CommunityRule Creative Team. 18 February 2027. ${minutes} minute read. `,
|
||||
);
|
||||
expect(collectHowItWorksGuideText(page)).toContain(
|
||||
"A Rule is a short document your community can read aloud in a few minutes.",
|
||||
);
|
||||
expect(collectHowItWorksGuideText(page)).not.toContain("](/kit)");
|
||||
});
|
||||
|
||||
it("builds wiki markdown from the title, description and URL", () => {
|
||||
expect(
|
||||
howItWorksWikiMarkdown(
|
||||
page.banner.title,
|
||||
page.banner.description,
|
||||
"https://communityrule.info/how-it-works",
|
||||
),
|
||||
).toBe(
|
||||
`[${page.banner.title}](https://communityrule.info/how-it-works)\n\n${page.banner.description}`,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user