Assert task relation test exists

Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
kolaente 2020-09-27 16:37:37 +02:00
parent cfadc0a784
commit 5330a96ce4
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 17 additions and 0 deletions

View File

@ -35,6 +35,12 @@ func TestTaskRelation_Create(t *testing.T) {
}
err := rel.Create(&user.User{ID: 1})
assert.NoError(t, err)
db.AssertDBExists(t, "task_relations", map[string]interface{}{
"task_id": 1,
"other_task_id": 2,
"relation_kind": RelationKindSubtask,
"created_by_id": 1,
}, false)
})
t.Run("Two Tasks In Different Lists", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
@ -46,6 +52,12 @@ func TestTaskRelation_Create(t *testing.T) {
}
err := rel.Create(&user.User{ID: 1})
assert.NoError(t, err)
db.AssertDBExists(t, "task_relations", map[string]interface{}{
"task_id": 1,
"other_task_id": 13,
"relation_kind": RelationKindSubtask,
"created_by_id": 1,
}, false)
})
t.Run("Already Existing", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
@ -83,6 +95,11 @@ func TestTaskRelation_Delete(t *testing.T) {
}
err := rel.Delete()
assert.NoError(t, err)
db.AssertDBMissing(t, "task_relations", map[string]interface{}{
"task_id": 1,
"other_task_id": 29,
"relation_kind": RelationKindSubtask,
})
})
t.Run("Not existing", func(t *testing.T) {
db.LoadAndAssertFixtures(t)