update
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/matst80/go-redis-inventory/pkg/inventory"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
"git.k6n.net/go-cart-actor/pkg/actor"
|
||||
@@ -25,8 +26,28 @@ func newTestGrain() *CartGrain {
|
||||
return NewCartGrain(123, time.Now())
|
||||
}
|
||||
|
||||
type MockReservationService struct {
|
||||
}
|
||||
|
||||
func (m *MockReservationService) ReserveForCart(ctx context.Context, req inventory.CartReserveRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockReservationService) ReleaseForCart(ctx context.Context, sku inventory.SKU, locationID inventory.LocationID, cartID inventory.CartID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockReservationService) GetAvailableInventory(ctx context.Context, sku inventory.SKU, locationID inventory.LocationID) (uint32, error) {
|
||||
return 1000, nil
|
||||
}
|
||||
|
||||
func newRegistry() actor.MutationRegistry {
|
||||
return NewCartMultationRegistry()
|
||||
cartCtx := &CartMutationContext{
|
||||
reservationService: &MockReservationService{
|
||||
reservations: []messages.Reservation{},
|
||||
},
|
||||
}
|
||||
return NewCartMultationRegistry(cartCtx)
|
||||
}
|
||||
|
||||
func msgAddItem(sku string, price int64, qty int32, storePtr *string) *messages.AddItem {
|
||||
|
||||
Reference in New Issue
Block a user