Import the remade decks on stable ids and recommend one card per job, so a saved draft still loads after a chip is renamed.
The real-group profiles stay as a test, so a change that moves a pick fails. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
96ca15d8e3
commit
bcbc6f30d9
89 files changed
+36555
-2828
No files matched your search
@@ -0,0 +1,68 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { migrateLegacyCreateFlowState } from "../../lib/create/migrateLegacyCreateFlowState";
|
||||
import { groupAnswersFromCreateFlowState } from "../../lib/create/groupAnswers";
|
||||
|
||||
describe("maturity and chip aliases", () => {
|
||||
it("scores one maturity answer and keeps a draft that stored several", () => {
|
||||
const draft = migrateLegacyCreateFlowState({
|
||||
selectedMaturityIds: ["1", "2", "4"],
|
||||
selectedOrganizationTypeIds: ["1"],
|
||||
});
|
||||
expect(draft.selectedMaturityIds).toEqual([
|
||||
"earlyStage",
|
||||
"growthStage",
|
||||
"established",
|
||||
]);
|
||||
expect(draft.selectedOrganizationTypeIds).toEqual(["workersCoop"]);
|
||||
const answers = groupAnswersFromCreateFlowState(draft);
|
||||
expect(answers.stage).toBe("earlyStage");
|
||||
expect(answers.mainKind).toBe("workersCoop");
|
||||
});
|
||||
|
||||
it("loads Enterprise and Larger organization as Established", () => {
|
||||
const fromId = migrateLegacyCreateFlowState({
|
||||
selectedMaturityIds: ["4"],
|
||||
communityStructureChipSnapshots: {
|
||||
maturity: [
|
||||
{ id: "1", label: "Early stage", state: "unselected" },
|
||||
{ id: "2", label: "Growth stage", state: "unselected" },
|
||||
{ id: "3", label: "Established", state: "unselected" },
|
||||
{ id: "4", label: "Enterprise", state: "selected" },
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(fromId.selectedMaturityIds).toEqual(["established"]);
|
||||
expect(
|
||||
fromId.communityStructureChipSnapshots?.maturity?.find(
|
||||
(row) => row.id === "established",
|
||||
)?.label,
|
||||
).toBe("Established");
|
||||
|
||||
const fromLabel = migrateLegacyCreateFlowState({
|
||||
selectedMaturityIds: ["larger-organization"],
|
||||
communityStructureChipSnapshots: {
|
||||
maturity: [
|
||||
{ id: "larger-organization", label: "Larger organization", state: "selected" },
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(fromLabel.selectedMaturityIds).toEqual(["established"]);
|
||||
});
|
||||
|
||||
it("keeps the worker co-op pick when the label was Worker cooperative", () => {
|
||||
const draft = migrateLegacyCreateFlowState({
|
||||
selectedOrganizationTypeIds: ["1"],
|
||||
communityStructureChipSnapshots: {
|
||||
organizationTypes: [
|
||||
{ id: "1", label: "Worker cooperative", state: "selected" },
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(draft.selectedOrganizationTypeIds).toEqual(["workersCoop"]);
|
||||
expect(
|
||||
draft.communityStructureChipSnapshots?.organizationTypes?.find(
|
||||
(row) => row.id === "workersCoop",
|
||||
)?.label,
|
||||
).toBe("Worker co-op");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user