more
All checks were successful
Build and Publish / Metadata (push) Successful in 8s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m12s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m9s

This commit is contained in:
matst80
2025-10-14 12:30:12 +02:00
parent 7a79efbb9f
commit 0b9c14c231
9 changed files with 201 additions and 25 deletions

View File

@@ -78,7 +78,7 @@ func TestRegisteredMutationBasics(t *testing.T) {
// Apply happy path
state := &cartState{}
add := &messages.AddItem{ItemId: 42, Quantity: 3, Sku: "ABC"}
if err := reg.Apply(state, add); err != nil {
if _, err := reg.Apply(state, add); err != nil {
t.Fatalf("Apply returned error: %v", err)
}
if state.calls != 1 {
@@ -89,17 +89,17 @@ func TestRegisteredMutationBasics(t *testing.T) {
}
// Apply nil grain
if err := reg.Apply(nil, add); err == nil {
if _, err := reg.Apply(nil, add); err == nil {
t.Fatalf("expected error for nil grain")
}
// Apply nil message
if err := reg.Apply(state, nil); err == nil {
if _, err := reg.Apply(state, nil); err == nil {
t.Fatalf("expected error for nil mutation message")
}
// Apply unregistered message
if err := reg.Apply(state, &messages.Noop{}); !errors.Is(err, ErrMutationNotRegistered) {
if _, err := reg.Apply(state, &messages.Noop{}); !errors.Is(err, ErrMutationNotRegistered) {
t.Fatalf("expected ErrMutationNotRegistered, got %v", err)
}
}