Add comprehensive kanban board tests and fix test suite
- Add 13 tests for task kanban categorization and button types - Fix i18n initialization in test setup (was causing nil pointer panics) - Add TaskCompletionImage to test DB auto-migrate - Update ListTasks tests to expect kanban board response instead of array 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -168,11 +168,23 @@ func TestTaskHandler_ListTasks(t *testing.T) {
|
||||
|
||||
testutil.AssertStatusCode(t, w, http.StatusOK)
|
||||
|
||||
var response []map[string]interface{}
|
||||
// ListTasks returns a kanban board object, not an array
|
||||
var response map[string]interface{}
|
||||
err := json.Unmarshal(w.Body.Bytes(), &response)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Len(t, response, 3)
|
||||
// Verify kanban structure
|
||||
assert.Contains(t, response, "columns")
|
||||
assert.Contains(t, response, "days_threshold")
|
||||
|
||||
// Count total tasks across all columns
|
||||
columns := response["columns"].([]interface{})
|
||||
totalTasks := 0
|
||||
for _, col := range columns {
|
||||
column := col.(map[string]interface{})
|
||||
totalTasks += int(column["count"].(float64))
|
||||
}
|
||||
assert.Equal(t, 3, totalTasks)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -651,16 +663,19 @@ func TestTaskHandler_JSONResponses(t *testing.T) {
|
||||
assert.IsType(t, false, response["is_archived"])
|
||||
})
|
||||
|
||||
t.Run("list response returns array", func(t *testing.T) {
|
||||
t.Run("list response returns kanban board", func(t *testing.T) {
|
||||
w := testutil.MakeRequest(router, "GET", "/api/tasks/", nil, "test-token")
|
||||
|
||||
testutil.AssertStatusCode(t, w, http.StatusOK)
|
||||
|
||||
var response []map[string]interface{}
|
||||
// ListTasks returns a kanban board object with columns
|
||||
var response map[string]interface{}
|
||||
err := json.Unmarshal(w.Body.Bytes(), &response)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Response should be an array of tasks
|
||||
assert.IsType(t, []map[string]interface{}{}, response)
|
||||
// Response should be a kanban board object
|
||||
assert.Contains(t, response, "columns")
|
||||
assert.Contains(t, response, "days_threshold")
|
||||
assert.IsType(t, []interface{}{}, response["columns"])
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user