feat(tasks): add tests for moving a task out of the done bucket
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
kolaente 2024-06-18 13:40:37 +02:00
parent 5e4b9e38a6
commit fa6546b6b2
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 31 additions and 1 deletions

View File

@ -3,7 +3,7 @@
bucket_id: 1
- task_id: 2
project_view_id: 4
bucket_id: 1
bucket_id: 3 # done bucket
- task_id: 3
project_view_id: 4
bucket_id: 2

View File

@ -305,6 +305,36 @@ func TestTask_Update(t *testing.T) {
"bucket_id": 3,
}, false)
})
t.Run("move done task out of done bucket", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
task := &Task{
ID: 2,
Title: "test",
ProjectID: 1,
BucketID: 1, // Bucket 1 is the default bucket
}
err := task.Update(s, u)
require.NoError(t, err)
err = s.Commit()
require.NoError(t, err)
assert.False(t, task.Done)
db.AssertExists(t, "tasks", map[string]interface{}{
"id": task.ID,
"done": false,
}, false)
db.AssertExists(t, "task_buckets", map[string]interface{}{
"task_id": task.ID,
"bucket_id": 1,
}, false)
db.AssertMissing(t, "task_buckets", map[string]interface{}{
"task_id": task.ID,
"bucket_id": 3,
})
})
t.Run("moving a repeating task to the done bucket", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()