diff --git a/models/book_test.go b/models/book_test.go index 448729b..ce696b7 100644 --- a/models/book_test.go +++ b/models/book_test.go @@ -105,6 +105,19 @@ func TestAddOrUpdateBook(t *testing.T) { // (ID, Created, Updated), this would fail if we'd just directly compared authorsbybook and testbook.Authors assert.Equal(t, len(authorsbybook), len(testbook.Authors)) + // Test Quantity + qty1, err := book1.getQuantity() + assert.NoError(t, err) + assert.Equal(t, book1.Quantity, qty1) + + // Update the quantity and check again + err = book1.setQuantity(int64(99)) + assert.NoError(t, err) + + qty2, err := book1.getQuantity() + assert.NoError(t, err) + assert.Equal(t, int64(99), qty2) + // Delete the book err = DeleteBookByID(book1.ID) assert.NoError(t, err)