This commit is contained in:
Trey t
2026-02-18 10:54:18 -06:00
parent a5245955af
commit 215e7c895d
11 changed files with 638 additions and 79 deletions

View File

@@ -943,7 +943,7 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
{"Cancelled Task 1 - Build shed", 3, 15, "cancelled"},
{"Cancelled Task 2 - Install pool", 4, 60, "cancelled"},
// Archived tasks (should appear in cancelled column)
// Archived tasks (hidden from kanban board)
{"Archived Task 1 - Old project", 0, -30, "archived"},
{"Archived Task 2 - Deprecated work", 1, -20, "archived"},
@@ -1059,7 +1059,7 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
var taskListResp map[string]interface{}
json.Unmarshal(w.Body.Bytes(), &taskListResp)
// Count total tasks across all columns
// Count total visible tasks across all columns
totalTasks := 0
if columns, ok := taskListResp["columns"].([]interface{}); ok {
for _, col := range columns {
@@ -1069,7 +1069,13 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
}
}
}
assert.Equal(t, 20, totalTasks, "Should have 20 total tasks")
expectedVisibleTasks := 0
for _, task := range createdTasks {
if task.ExpectedColumn != "" {
expectedVisibleTasks++
}
}
assert.Equal(t, expectedVisibleTasks, totalTasks, "Should have %d visible tasks", expectedVisibleTasks)
// Verify individual task retrieval
for _, task := range createdTasks {
@@ -1131,7 +1137,6 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
"due_soon_tasks": false,
"upcoming_tasks": false,
"completed_tasks": false,
"cancelled_tasks": false,
}
for _, col := range columns {
@@ -1191,10 +1196,29 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
}
}
// Verify EACH task by ID is in its expected column
// This catches swaps where counts match but tasks are in wrong columns
// Verify each task is in expected column (or hidden for cancelled/archived)
t.Log(" Verifying each task's column membership by ID:")
for _, task := range createdTasks {
if task.ExpectedColumn == "" {
found := false
for colName, ids := range columnTaskIDs {
for _, id := range ids {
if id == task.ID {
found = true
assert.Fail(t, "Hidden task unexpectedly visible",
"Task ID %d ('%s') should be hidden from kanban but appeared in '%s'",
task.ID, task.Title, colName)
break
}
}
}
assert.False(t, found, "Task ID %d ('%s') should be hidden from kanban", task.ID, task.Title)
if !found {
t.Logf(" ✓ Task %d ('%s') correctly hidden from board", task.ID, task.Title)
}
continue
}
actualIDs := columnTaskIDs[task.ExpectedColumn]
found := false
for _, id := range actualIDs {
@@ -1210,14 +1234,14 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
}
}
// Verify total equals 20 (sanity check)
// Verify total equals expected visible tasks (sanity check)
total := 0
for _, ids := range columnTaskIDs {
total += len(ids)
}
assert.Equal(t, 20, total, "Total tasks across all columns should be 20")
assert.Equal(t, expectedVisibleTasks, total, "Total tasks across all columns should be %d", expectedVisibleTasks)
t.Log("✓ All 20 tasks verified in correct columns by ID")
t.Logf("✓ All %d visible tasks verified in correct columns by ID", expectedVisibleTasks)
// ============ Phase 9: Create User B ============
t.Log("Phase 9: Creating User B and verifying login")
@@ -1335,7 +1359,7 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
// Count expected tasks for shared residence (residenceIndex=0 in our config)
expectedTasksForResidence := 0
for _, task := range createdTasks {
if task.ResidenceID == sharedResidenceID {
if task.ResidenceID == sharedResidenceID && task.ExpectedColumn != "" {
expectedTasksForResidence++
}
}
@@ -1409,7 +1433,7 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
expectedColumnNames := []string{
"overdue_tasks", "in_progress_tasks", "due_soon_tasks",
"upcoming_tasks", "completed_tasks", "cancelled_tasks",
"upcoming_tasks", "completed_tasks",
}
for _, colName := range expectedColumnNames {
assert.True(t, foundColumns[colName], "User B should have column: %s", colName)
@@ -1530,16 +1554,16 @@ func TestIntegration_ComprehensiveE2E(t *testing.T) {
// based on its due date offset, status, and threshold
func determineExpectedColumn(daysFromNow int, status string, threshold int) string {
// This must match the categorization chain priority order:
// 1. Cancelled (priority 1)
// 2. Archived (priority 2)
// 3. Completed (priority 3)
// 4. InProgress (priority 4) - takes precedence over date-based columns!
// 5. Overdue (priority 5)
// 6. DueSoon (priority 6)
// 7. Upcoming (priority 7)
// Cancelled and archived tasks are intentionally hidden from kanban board view.
// Remaining visible columns follow:
// 1. Completed
// 2. InProgress (takes precedence over date-based columns)
// 3. Overdue
// 4. DueSoon
// 5. Upcoming
switch status {
case "cancelled", "archived":
return "cancelled_tasks"
return "" // Hidden from board
case "completed":
return "completed_tasks"
case "in_progress":