Assert exists in namespace tests

Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
kolaente 2020-09-27 14:21:41 +02:00
parent 64f9c922e4
commit 7cabf126b0
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 11 additions and 0 deletions

View File

@ -37,6 +37,10 @@ func TestNamespace_Create(t *testing.T) {
db.LoadAndAssertFixtures(t)
err := dummynamespace.Create(user1)
assert.NoError(t, err)
db.AssertDBExists(t, "namespaces", map[string]interface{}{
"title": "Test",
"description": "Lorem Ipsum",
}, false)
})
t.Run("no title", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
@ -81,6 +85,10 @@ func TestNamespace_Update(t *testing.T) {
}
err := n.Update()
assert.NoError(t, err)
db.AssertDBExists(t, "namespaces", map[string]interface{}{
"id": 1,
"title": "Lorem Ipsum",
}, false)
})
t.Run("nonexisting", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
@ -122,6 +130,9 @@ func TestNamespace_Delete(t *testing.T) {
}
err := n.Delete()
assert.NoError(t, err)
db.AssertDBMissing(t, "namespaces", map[string]interface{}{
"id": 1,
})
})
t.Run("nonexisting", func(t *testing.T) {
db.LoadAndAssertFixtures(t)