feat(tasks): add tests for moving a task out of the done bucket
This commit is contained in:
parent
5e4b9e38a6
commit
fa6546b6b2
@ -3,7 +3,7 @@
|
|||||||
bucket_id: 1
|
bucket_id: 1
|
||||||
- task_id: 2
|
- task_id: 2
|
||||||
project_view_id: 4
|
project_view_id: 4
|
||||||
bucket_id: 1
|
bucket_id: 3 # done bucket
|
||||||
- task_id: 3
|
- task_id: 3
|
||||||
project_view_id: 4
|
project_view_id: 4
|
||||||
bucket_id: 2
|
bucket_id: 2
|
||||||
|
@ -305,6 +305,36 @@ func TestTask_Update(t *testing.T) {
|
|||||||
"bucket_id": 3,
|
"bucket_id": 3,
|
||||||
}, false)
|
}, 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) {
|
t.Run("moving a repeating task to the done bucket", func(t *testing.T) {
|
||||||
db.LoadAndAssertFixtures(t)
|
db.LoadAndAssertFixtures(t)
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user