Book unit test improvements
This commit is contained in:
parent
df0482dac2
commit
d171d1f787
|
@ -96,6 +96,15 @@ func TestAddOrUpdateBook(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Equal(t, testbook.Title, book1updated.Title)
|
||||
|
||||
// Get the authors for that book
|
||||
authorsbybook, err := GetAuthorsByBook(book1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Check if they are the right ones
|
||||
// Yes I know, this is not a good way to do this. But as we get additional information when selecting from the database
|
||||
// (ID, Created, Updated), this would fail if we'd just directly compared authorsbybook and testbook.Authors
|
||||
assert.Equal(t, len(authorsbybook), len(testbook.Authors))
|
||||
|
||||
// Delete the book
|
||||
err = DeleteBookByID(book1.ID)
|
||||
assert.NoError(t, err)
|
||||
|
|
Loading…
Reference in New Issue