Assert exists in list tests

Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
kolaente 2020-09-27 13:30:32 +02:00
parent 38968d4ffc
commit 588b538fb8
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 21 additions and 1 deletions

View File

@ -41,6 +41,12 @@ func TestList_CreateOrUpdate(t *testing.T) {
}
err := list.Create(usr)
assert.NoError(t, err)
db.AssertDBExists(t, "list", map[string]interface{}{
"id": list.ID,
"title": list.Title,
"description": list.Description,
"namespace_id": list.NamespaceID,
}, false)
})
t.Run("nonexistant namespace", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
@ -88,6 +94,12 @@ func TestList_CreateOrUpdate(t *testing.T) {
}
err := list.Create(usr)
assert.NoError(t, err)
db.AssertDBExists(t, "list", map[string]interface{}{
"id": list.ID,
"title": list.Title,
"description": list.Description,
"namespace_id": list.NamespaceID,
}, false)
})
})
@ -103,7 +115,12 @@ func TestList_CreateOrUpdate(t *testing.T) {
list.Description = "Lorem Ipsum dolor sit amet."
err := list.Update()
assert.NoError(t, err)
db.AssertDBExists(t, "list", map[string]interface{}{
"id": list.ID,
"title": list.Title,
"description": list.Description,
"namespace_id": list.NamespaceID,
}, false)
})
t.Run("nonexistant", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
@ -139,6 +156,9 @@ func TestList_Delete(t *testing.T) {
}
err := list.Delete()
assert.NoError(t, err)
db.AssertDBMissing(t, "list", map[string]interface{}{
"id": 1,
})
}
func TestList_ReadAll(t *testing.T) {