test: verify task bucket assignment for list views with manual buckets

This commit is contained in:
kolaente 2026-04-12 18:22:30 +02:00
parent 939eba7b44
commit a32f759228
1 changed files with 25 additions and 0 deletions

View File

@ -158,6 +158,31 @@ func TestTask_Create(t *testing.T) {
require.Error(t, err)
assert.True(t, user.IsErrUserDoesNotExist(err))
})
t.Run("task assigned to list view with manual buckets", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
task := &Task{
Title: "Test list view bucket assignment",
ProjectID: 1,
}
err := task.Create(s, usr)
require.NoError(t, err)
require.NoError(t, s.Commit())
// Task should be assigned to default bucket of the list view with manual buckets (view 161, bucket 41)
db.AssertExists(t, "task_buckets", map[string]interface{}{
"task_id": task.ID,
"bucket_id": 41,
"project_view_id": 161,
}, false)
// Task should also still be assigned to the kanban view's default bucket
db.AssertExists(t, "task_buckets", map[string]interface{}{
"task_id": task.ID,
"bucket_id": 1,
}, false)
})
t.Run("default bucket different", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()