Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/domain/goals/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tests/domain/goals/Goal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down Expand Up @@ -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", () => {
Expand Down Expand Up @@ -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`
);
});

Expand Down
Loading