Assert task comment test exists

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

View File

@ -35,6 +35,12 @@ func TestTaskComment_Create(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "test", tc.Comment)
assert.Equal(t, int64(1), tc.Author.ID)
db.AssertDBExists(t, "task_comments", map[string]interface{}{
"id": tc.ID,
"author_id": u.ID,
"comment": "test",
"task_id": 1,
}, false)
})
t.Run("nonexisting task", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
@ -54,6 +60,9 @@ func TestTaskComment_Delete(t *testing.T) {
tc := &TaskComment{ID: 1}
err := tc.Delete()
assert.NoError(t, err)
db.AssertDBMissing(t, "task_comments", map[string]interface{}{
"id": 1,
})
})
t.Run("nonexisting comment", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
@ -73,6 +82,10 @@ func TestTaskComment_Update(t *testing.T) {
}
err := tc.Update()
assert.NoError(t, err)
db.AssertDBExists(t, "task_comments", map[string]interface{}{
"id": 1,
"comment": "testing",
}, false)
})
t.Run("nonexisting comment", func(t *testing.T) {
db.LoadAndAssertFixtures(t)