Custom add and create flow polish

This commit is contained in:
adilallo
2026-05-08 20:32:24 -06:00
parent 26bcd61ea3
commit 026a1e6d71
68 changed files with 6208 additions and 527 deletions
@@ -166,4 +166,52 @@ describe("applyFinalReviewChipEditPatch", () => {
"550e8400-e29b-41d4-a716-446655440000": patch.customMethodCardFieldBlocks,
});
});
it("merges customMethodCardMetaById when the patch carries methodCardMeta", () => {
const state: CreateFlowState = {
customMethodCardMetaById: {
signal: { label: "Signal", supportText: "Old" },
},
};
const patch: FinalReviewChipEditPatch = {
groupKey: "communication",
overrideKey: "signal",
value: {
corePrinciple: "p",
logisticsAdmin: "l",
codeOfConduct: "c",
},
methodCardMeta: { label: "Signal (edited)", supportText: "New sub" },
};
const result = applyFinalReviewChipEditPatch(state, patch);
expect(result.customMethodCardMetaById).toEqual({
signal: { label: "Signal (edited)", supportText: "New sub" },
});
});
it("updates coreValuesChipsSnapshot label when patch carries chipLabel", () => {
const state: CreateFlowState = {
coreValuesChipsSnapshot: [
{ id: "1", label: "Accessibility", state: "selected" },
],
coreValueDetailsByChipId: { "1": { meaning: "m", signals: "s" } },
};
const patch: FinalReviewChipEditPatch = {
groupKey: "coreValues",
overrideKey: "1",
value: { meaning: "m2", signals: "s2" },
chipLabel: "A11y renamed",
};
const result = applyFinalReviewChipEditPatch(state, patch);
expect(result.coreValuesChipsSnapshot).toEqual([
{ id: "1", label: "A11y renamed", state: "selected" },
]);
expect(result.coreValueDetailsByChipId).toEqual({
"1": { meaning: "m2", signals: "s2" },
});
});
});