diff --git a/src/domain/goals/Constants.ts b/src/domain/goals/Constants.ts index 8c944ea8..7253057c 100644 --- a/src/domain/goals/Constants.ts +++ b/src/domain/goals/Constants.ts @@ -111,7 +111,7 @@ export const GoalLimits = { SUCCESS_CRITERION_MAX_LENGTH: 1000, MAX_SUCCESS_CRITERIA: 50, SCOPE_ITEM_MAX_LENGTH: 200, - MAX_SCOPE_ITEMS: 20, + MAX_SCOPE_ITEMS: 100, NOTE_MAX_LENGTH: 500, // Embedded context: file path limits (only validation needed - other fields pre-validated by source aggregates) FILE_PATH_MAX_LENGTH: 500 diff --git a/tests/domain/goals/Goal.test.ts b/tests/domain/goals/Goal.test.ts index 9d50304e..9534866b 100644 --- a/tests/domain/goals/Goal.test.ts +++ b/tests/domain/goals/Goal.test.ts @@ -3,7 +3,7 @@ */ import { Goal } from "../../../src/domain/goals/Goal"; -import { GoalEventType, GoalStatus } from "../../../src/domain/goals/Constants"; +import { GoalEventType, GoalStatus, GoalLimits } from "../../../src/domain/goals/Constants"; import type { GoalEvent } from "../../../src/domain/goals/EventIndex"; describe("Goal Aggregate", () => { @@ -174,12 +174,12 @@ describe("Goal Aggregate", () => { it("should throw error if too many scope items", () => { // Arrange const goal = Goal.create("goal_123"); - const tooManyItems = Array.from({ length: 21 }, (_, i) => `Item ${i}`); + const tooManyItems = Array.from({ length: GoalLimits.MAX_SCOPE_ITEMS + 1 }, (_, i) => `Item ${i}`); // Act & Assert expect(() => goal.add("Test goal", "My objective", ["Criterion 1"], tooManyItems) - ).toThrow("Cannot have more than 20 scope items"); + ).toThrow(`Cannot have more than ${GoalLimits.MAX_SCOPE_ITEMS} scope items`); }); it("should throw error if scope item is too long", () => { @@ -618,11 +618,11 @@ describe("Goal Aggregate", () => { // Arrange const goal = Goal.create("goal_123"); goal.add("Original goal", "Original objective", ["Criterion 1"]); - const tooManyItems = Array.from({ length: 21 }, (_, i) => `Item ${i}`); + const tooManyItems = Array.from({ length: GoalLimits.MAX_SCOPE_ITEMS + 1 }, (_, i) => `Item ${i}`); // Act & Assert expect(() => goal.update(undefined, undefined, undefined, tooManyItems)).toThrow( - "Cannot have more than 20 scope items" + `Cannot have more than ${GoalLimits.MAX_SCOPE_ITEMS} scope items` ); });