Skip setup questions on the template path and collect name, photo, and description without recommendations.

Customize opens a dialog then walks the template decks; Use without changes lands on final review with Has Name Field. Template cards stay first, the engine is not called, and the catalog no longer shows a recommended tag.
This commit is contained in:
adilallo committed 2026-11-09 17:34:33 -07:00
1 parent 53d236d0d5
commit 6498d52541
37 files changed
+1450 -733

No files matched your search

@@ -69,22 +69,56 @@ describe("useTemplateReviewActions", () => {
);
}
it("direct Use without changes walks identity from community-name", async () => {
it("Customize opens the dialog and does not route until Continue", async () => {
const { result } = renderActions({});
await act(async () => {
await result.current.handleUseWithoutChanges();
await result.current.handleCustomize();
});
expect(markCreateFlowInteraction).toHaveBeenCalled();
expect(router.push).toHaveBeenCalledWith("/create/community-name");
expect(applied?.pendingTemplateAction).toEqual({
slug: "mutual-aid-mondays",
mode: "useWithoutChanges",
});
expect(router.push).not.toHaveBeenCalled();
expect(result.current.customizeDialog).toEqual(
expect.objectContaining({
slug: "mutual-aid-mondays",
templateTitle: "Mutual Aid Mondays",
}),
);
});
it("direct Use without changes ignores a leftover draft title", async () => {
it("Customize Continue prefills cards, drops setup answers, and walks the decks", async () => {
const { result } = renderActions({
setupTraits: { employer: true },
});
await act(async () => {
await result.current.handleCustomize();
});
act(() => {
result.current.confirmCustomizeDialog({
title: "Neighborhood",
communityContext: "We meet weekly",
communityLocation: "Oakland",
});
});
expect(router.push).toHaveBeenCalledWith("/create/core-values");
expect(updateState).toHaveBeenCalledWith(
expect.objectContaining({
title: "Neighborhood",
communityContext: "We meet weekly",
communityLocation: "Oakland",
setupTraits: undefined,
pendingTemplateAction: {
slug: "mutual-aid-mondays",
mode: "customize",
},
templateReviewBackSlug: "mutual-aid-mondays",
}),
);
});
it("direct Use without changes goes to final review and clears leftover identity", async () => {
replaceState.mockImplementation(
(updater: (_prev: CreateFlowState) => CreateFlowState) => {
applied = updater({
@@ -101,15 +135,18 @@ describe("useTemplateReviewActions", () => {
await result.current.handleUseWithoutChanges();
});
expect(router.push).toHaveBeenCalledWith("/create/community-name");
expect(router.push).toHaveBeenCalledWith("/create/final-review");
expect(applied?.title).toBeUndefined();
expect(applied?.communityContext).toBeUndefined();
expect(applied?.currentStep).toBeUndefined();
expect(applied?.setupTraits).toBeUndefined();
expect(applied?.pendingTemplateAction?.mode).toBe("useWithoutChanges");
expect(applied?.pendingTemplateAction).toEqual({
slug: "mutual-aid-mondays",
mode: "useWithoutChanges",
});
});
it("in-flow Use without changes skips identity and keeps the community name", async () => {
it("in-flow Use without changes keeps the community name and pins the template path", async () => {
replaceState.mockImplementation(
(updater: (_prev: CreateFlowState) => CreateFlowState) => {
applied = updater({
@@ -132,38 +169,11 @@ describe("useTemplateReviewActions", () => {
expect(router.push).toHaveBeenCalledWith("/create/final-review");
expect(applied?.title).toBe("Neighborhood");
expect(applied?.communityContext).toBe("We meet weekly");
expect(applied?.setupTraits).toEqual({ employer: true });
expect(applied?.pendingTemplateAction).toBeUndefined();
expect(applied?.setupTraits).toBeUndefined();
expect(applied?.pendingTemplateAction).toEqual({
slug: "mutual-aid-mondays",
mode: "useWithoutChanges",
});
expect(applied?.templateReviewBackSlug).toBe("mutual-aid-mondays");
});
it("customize with a community name drops leftover setup answers", async () => {
const { result } = renderActions({
title: "Neighborhood",
setupTraits: { employer: true },
});
await act(async () => {
await result.current.handleCustomize();
});
expect(router.push).toHaveBeenCalledWith("/create/core-values");
expect(updateState).toHaveBeenCalledWith(
expect.objectContaining({ setupTraits: undefined }),
);
});
it("customize without a community name leaves setup answers for the questionnaire", async () => {
const { result } = renderActions({
setupTraits: { employer: true },
});
await act(async () => {
await result.current.handleCustomize();
});
expect(router.push).toHaveBeenCalledWith("/create/informational");
const patch = updateState.mock.calls[0]?.[0] as CreateFlowState;
expect(patch).not.toHaveProperty("setupTraits");
});
});