From be3184d49ff7a97a964ead5140ce17a10f044a8e Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 24 Mar 2021 22:47:03 +0100 Subject: [PATCH] Add test for moving a task to another list --- pkg/models/tasks_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/models/tasks_test.go b/pkg/models/tasks_test.go index 67a5db28..725c2c40 100644 --- a/pkg/models/tasks_test.go +++ b/pkg/models/tasks_test.go @@ -282,6 +282,26 @@ func TestTask_Update(t *testing.T) { "bucket_id": 3, }, false) }) + t.Run("move task to another list", func(t *testing.T) { + db.LoadAndAssertFixtures(t) + s := db.NewSession() + defer s.Close() + + task := &Task{ + ID: 1, + ListID: 2, + } + err := task.Update(s, u) + assert.NoError(t, err) + err = s.Commit() + assert.NoError(t, err) + + db.AssertExists(t, "tasks", map[string]interface{}{ + "id": 1, + "list_id": 2, + "bucket_id": 4, + }, false) + }) } func TestTask_Delete(t *testing.T) {