Keep the template picker in the create flow, make catalog cards real links, and stop showing a fake community when review has no draft.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
adilallo
2026-09-10 15:22:46 -06:00
co-authored by Cursor
parent 3f9a8395be
commit 90db213413
31 changed files with 412 additions and 126 deletions
+40 -12
View File
@@ -10,6 +10,18 @@ import { CommunityReviewScreen } from "../../app/(app)/create/screens/review/Com
import { useCreateFlow } from "../../app/(app)/create/context/CreateFlowContext";
import { testRouter } from "../mocks/navigation";
function ReviewWithTitle({ title }: { title: string }) {
const { state, updateState } = useCreateFlow();
const seededRef = React.useRef(false);
useEffect(() => {
if (seededRef.current) return;
seededRef.current = true;
updateState({ title });
}, [title, updateState]);
if (state.title !== title) return null;
return <CommunityReviewScreen />;
}
describe("CommunityReviewScreen", () => {
beforeEach(() => {
testRouter.replace.mockReset();
@@ -21,8 +33,24 @@ describe("CommunityReviewScreen", () => {
expect(screen.getByRole("heading", { level: 1 })).toBeInTheDocument();
});
it("renders HeaderLockup with expected title", () => {
it("shows an empty state instead of a baked-in community name", () => {
render(<CommunityReviewScreen />);
expect(
screen.getByRole("heading", { name: "No community in progress yet" }),
).toBeInTheDocument();
expect(screen.queryByText("Mutual Aid Mondays")).not.toBeInTheDocument();
expect(
screen.queryByRole("heading", {
name: "Your community is added - congrats!",
}),
).not.toBeInTheDocument();
expect(
screen.getByRole("link", { name: "Start creating" }),
).toHaveAttribute("href", "/create/informational");
});
it("renders HeaderLockup with expected title when a community name exists", () => {
render(<ReviewWithTitle title="Garden Club" />);
expect(
screen.getByRole("heading", {
name: "Your community is added - congrats!",
@@ -30,8 +58,8 @@ describe("CommunityReviewScreen", () => {
).toBeInTheDocument();
});
it("renders HeaderLockup with expected description", () => {
render(<CommunityReviewScreen />);
it("renders HeaderLockup with expected description when a community name exists", () => {
render(<ReviewWithTitle title="Garden Club" />);
expect(
screen.getByText(
/In the next section, we'll go through membership, decision-making, conflict resolution, and community values and create a custom operating manual for your organization based on the specifics you just shared./i,
@@ -39,13 +67,13 @@ describe("CommunityReviewScreen", () => {
).toBeInTheDocument();
});
it("renders Rule with title fallback when no community name is set", () => {
render(<CommunityReviewScreen />);
expect(screen.getByText("Mutual Aid Mondays")).toBeInTheDocument();
it("renders Rule with the community name from state", () => {
render(<ReviewWithTitle title="Garden Club" />);
expect(screen.getByText("Garden Club")).toBeInTheDocument();
});
it("omits the Rule description when the user has not entered community context", () => {
render(<CommunityReviewScreen />);
render(<ReviewWithTitle title="Garden Club" />);
expect(
screen.queryByText(
/Mutual Aid Monday is a grassroots community in Denver/i,
@@ -53,13 +81,13 @@ describe("CommunityReviewScreen", () => {
).not.toBeInTheDocument();
});
it("renders Rule as a button (card is interactive)", () => {
render(<CommunityReviewScreen />);
it("renders Rule as a button when a community name exists", () => {
render(<ReviewWithTitle title="Garden Club" />);
const buttons = screen.getAllByRole("button");
expect(buttons.length).toBeGreaterThanOrEqual(1);
expect(
buttons.some((el) => el.textContent?.includes("Mutual Aid Mondays")),
).toBe(true);
expect(buttons.some((el) => el.textContent?.includes("Garden Club"))).toBe(
true,
);
});
});