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
@@ -23,39 +23,42 @@ const emptyEntry = (): DecisionApproachDetailEntry => ({
|
||||
});
|
||||
|
||||
describe("decisionApproachKeyResources", () => {
|
||||
it("reads the four key-resource items from messages", () => {
|
||||
it("reads the decision checklist from messages", () => {
|
||||
expect(decisionApproachKeyResourceItems()).toEqual([
|
||||
{ id: "amend", label: "Amend your CommunityRule" },
|
||||
{ id: "finances", label: "Steward finances" },
|
||||
{ id: "project", label: "Project level decisions" },
|
||||
{ id: "discipline", label: "Discipline and member termination" },
|
||||
{ id: "everyday", label: "Everyday decisions" },
|
||||
{ id: "big", label: "Big decisions" },
|
||||
{ id: "amend", label: "Changing this Rule" },
|
||||
{ id: "emergency", label: "Emergencies" },
|
||||
{ id: "finances", label: "Shared money" },
|
||||
{ id: "spending", label: "Spending" },
|
||||
{ id: "roles", label: "Roles and working groups" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("selects checked key-resource labels without rewriting applicableScope", () => {
|
||||
const next = applyDecisionApproachKeyResources(emptyEntry(), [
|
||||
"Steward finances",
|
||||
"Shared money",
|
||||
]);
|
||||
expect(next.applicableScope).toEqual(["Daily Operations"]);
|
||||
expect(next.selectedApplicableScope).toEqual(["Steward finances"]);
|
||||
expect(next.selectedApplicableScope).toEqual(["Shared money"]);
|
||||
});
|
||||
|
||||
it("keeps non-key chip selections when syncing sidebar checks", () => {
|
||||
const next = applyDecisionApproachKeyResources(
|
||||
{
|
||||
...emptyEntry(),
|
||||
applicableScope: ["Steward finances", "Daily Operations"],
|
||||
applicableScope: ["Shared money", "Daily Operations"],
|
||||
selectedApplicableScope: ["Daily Operations"],
|
||||
},
|
||||
["Steward finances"],
|
||||
["Shared money"],
|
||||
);
|
||||
expect(next.applicableScope).toEqual([
|
||||
"Steward finances",
|
||||
"Shared money",
|
||||
"Daily Operations",
|
||||
]);
|
||||
expect(next.selectedApplicableScope).toEqual([
|
||||
"Daily Operations",
|
||||
"Steward finances",
|
||||
"Shared money",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -63,19 +66,19 @@ describe("decisionApproachKeyResources", () => {
|
||||
expect(
|
||||
decisionApproachScopeForPublish(
|
||||
["Daily Operations", "Minor Expenditures"],
|
||||
["Steward finances"],
|
||||
["Shared money"],
|
||||
),
|
||||
).toEqual([
|
||||
"Daily Operations",
|
||||
"Minor Expenditures",
|
||||
"Steward finances",
|
||||
"Shared money",
|
||||
]);
|
||||
expect(
|
||||
decisionApproachScopeForPublish(
|
||||
["Daily Operations", "Minor Expenditures"],
|
||||
["Daily Operations", "Steward finances"],
|
||||
["Daily Operations", "Shared money"],
|
||||
),
|
||||
).toEqual(["Daily Operations", "Steward finances"]);
|
||||
).toEqual(["Daily Operations", "Shared money"]);
|
||||
expect(
|
||||
decisionApproachScopeForPublish(
|
||||
["Daily Operations", "Minor Expenditures"],
|
||||
@@ -85,44 +88,44 @@ describe("decisionApproachKeyResources", () => {
|
||||
});
|
||||
|
||||
it("maps checkbox ids to labels and back", () => {
|
||||
expect(selectedKeyResourceLabelsFromCheckedIds(["amend", "project"])).toEqual(
|
||||
["Amend your CommunityRule", "Project level decisions"],
|
||||
expect(selectedKeyResourceLabelsFromCheckedIds(["amend", "big"])).toEqual(
|
||||
["Big decisions", "Changing this Rule"],
|
||||
);
|
||||
expect(
|
||||
decisionApproachKeyResourceIdsFromLabels([
|
||||
"Project level decisions",
|
||||
"Big decisions",
|
||||
"Unknown",
|
||||
"Amend your CommunityRule",
|
||||
"Changing this Rule",
|
||||
]),
|
||||
).toEqual(["amend", "project"]);
|
||||
).toEqual(["big", "amend"]);
|
||||
});
|
||||
|
||||
it("derives sidebar checks from the open draft or selected approaches", () => {
|
||||
const detailsById = {
|
||||
"lazy-consensus": {
|
||||
...emptyEntry(),
|
||||
selectedApplicableScope: ["Steward finances"],
|
||||
selectedApplicableScope: ["Shared money"],
|
||||
},
|
||||
"do-ocracy": {
|
||||
...emptyEntry(),
|
||||
selectedApplicableScope: ["Project level decisions"],
|
||||
selectedApplicableScope: ["Big decisions"],
|
||||
},
|
||||
};
|
||||
expect(
|
||||
decisionApproachKeyResourceCheckboxIds({
|
||||
detailsById,
|
||||
selectedApproachIds: ["lazy-consensus", "do-ocracy"],
|
||||
reminderIds: ["discipline"],
|
||||
reminderIds: ["spending"],
|
||||
}),
|
||||
).toEqual(["finances", "project", "discipline"]);
|
||||
).toEqual(["big", "finances", "spending"]);
|
||||
expect(
|
||||
decisionApproachKeyResourceCheckboxIds({
|
||||
detailsById,
|
||||
selectedApproachIds: ["lazy-consensus", "do-ocracy"],
|
||||
reminderIds: ["discipline"],
|
||||
reminderIds: ["spending"],
|
||||
openDraft: {
|
||||
...emptyEntry(),
|
||||
selectedApplicableScope: ["Amend your CommunityRule"],
|
||||
selectedApplicableScope: ["Changing this Rule"],
|
||||
},
|
||||
}),
|
||||
).toEqual(["amend"]);
|
||||
@@ -132,7 +135,7 @@ describe("decisionApproachKeyResources", () => {
|
||||
const next = syncDecisionApproachKeyResourceDetails(
|
||||
{ "lazy-consensus": emptyEntry() },
|
||||
["do-ocracy"],
|
||||
["Amend your CommunityRule"],
|
||||
["Changing this Rule"],
|
||||
(id) => ({
|
||||
...emptyEntry(),
|
||||
corePrinciple: id,
|
||||
@@ -140,19 +143,19 @@ describe("decisionApproachKeyResources", () => {
|
||||
}),
|
||||
);
|
||||
expect(next["lazy-consensus"]?.selectedApplicableScope).toEqual([
|
||||
"Amend your CommunityRule",
|
||||
"Changing this Rule",
|
||||
]);
|
||||
expect(next["do-ocracy"]?.corePrinciple).toBe("do-ocracy");
|
||||
expect(next["do-ocracy"]?.applicableScope).toEqual(["Volunteer Tasks"]);
|
||||
expect(next["do-ocracy"]?.selectedApplicableScope).toEqual([
|
||||
"Amend your CommunityRule",
|
||||
"Changing this Rule",
|
||||
]);
|
||||
});
|
||||
|
||||
it("compares string arrays by order", () => {
|
||||
expect(stringArraysEqual(["a", "b"], ["a", "b"])).toBe(true);
|
||||
expect(stringArraysEqual(["a", "b"], ["b", "a"])).toBe(false);
|
||||
expect(decisionApproachKeyResourceLabels()).toHaveLength(4);
|
||||
expect(decisionApproachKeyResourceLabels()).toHaveLength(7);
|
||||
});
|
||||
|
||||
it("unions key-resource labels onto an existing scope list", () => {
|
||||
@@ -160,10 +163,13 @@ describe("decisionApproachKeyResources", () => {
|
||||
withDecisionApproachKeyResourceScopes(["Daily Operations"]),
|
||||
).toEqual([
|
||||
"Daily Operations",
|
||||
"Amend your CommunityRule",
|
||||
"Steward finances",
|
||||
"Project level decisions",
|
||||
"Discipline and member termination",
|
||||
"Everyday decisions",
|
||||
"Big decisions",
|
||||
"Changing this Rule",
|
||||
"Emergencies",
|
||||
"Shared money",
|
||||
"Spending",
|
||||
"Roles and working groups",
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user