update stuff
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m52s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m52s
This commit is contained in:
@@ -39,5 +39,23 @@ func TestAddToCart(t *testing.T) {
|
||||
if grain.TotalPrice != 200 {
|
||||
t.Errorf("Expected total price 200, got %d\n", grain.TotalPrice)
|
||||
}
|
||||
|
||||
if len(grain.Items) != 1 {
|
||||
t.Errorf("Expected 1 item, got %d\n", len(grain.Items))
|
||||
}
|
||||
if grain.Items[0].Quantity != 2 {
|
||||
t.Errorf("Expected quantity 2, got %d\n", grain.Items[0].Quantity)
|
||||
}
|
||||
result, err = grain.HandleMessage(msg, false)
|
||||
if err != nil {
|
||||
t.Errorf("Error handling message: %v\n", err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Expected result, got nil\n")
|
||||
}
|
||||
if grain.Items[0].Quantity != 4 {
|
||||
t.Errorf("Expected quantity 4, got %d\n", grain.Items[0].Quantity)
|
||||
}
|
||||
if grain.TotalPrice != 400 {
|
||||
t.Errorf("Expected total price 400, got %d\n", grain.TotalPrice)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user