Added unit test for item quantities
the build failed Details

This commit is contained in:
konrad 2018-01-16 16:01:42 +01:00 committed by kolaente
parent 8da6ca8e0b
commit 3822e4a09e
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,19 @@ func TestAddOrUpdateItem(t *testing.T) {
assert.Equal(t, testitem.Description, item1updated.Description)
assert.Equal(t, testitem.Other, item1updated.Other)
// Test Quantity
qty1, err := item1.getQuantity()
assert.NoError(t, err)
assert.Equal(t, item1.Quantity, qty1)
// Update the quantity and check again
err = item1.setQuantity(int64(99))
assert.NoError(t, err)
qty2, err := item1.getQuantity()
assert.NoError(t, err)
assert.Equal(t, int64(99), qty2)
// Delete the item
err = DeleteItemByID(item1.ID)
assert.NoError(t, err)