Added unit test for item quantities
the build failed
Details
the build failed
Details
This commit is contained in:
parent
8da6ca8e0b
commit
3822e4a09e
|
@ -64,6 +64,19 @@ func TestAddOrUpdateItem(t *testing.T) {
|
||||||
assert.Equal(t, testitem.Description, item1updated.Description)
|
assert.Equal(t, testitem.Description, item1updated.Description)
|
||||||
assert.Equal(t, testitem.Other, item1updated.Other)
|
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
|
// Delete the item
|
||||||
err = DeleteItemByID(item1.ID)
|
err = DeleteItemByID(item1.ID)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
Loading…
Reference in New Issue