flamingo.me/flamingo-commerce/v3@v3.11.0/checkout/domain/placeorder/states/show_wallet_payment_test.go (about) 1 package states_test 2 3 import ( 4 "context" 5 "testing" 6 7 "flamingo.me/flamingo-commerce/v3/checkout/domain/placeorder/process" 8 "flamingo.me/flamingo-commerce/v3/checkout/domain/placeorder/states" 9 "flamingo.me/flamingo-commerce/v3/payment/application" 10 11 "github.com/stretchr/testify/assert" 12 ) 13 14 func TestShowWalletPayment_IsFinal(t *testing.T) { 15 s := states.ShowWalletPayment{} 16 assert.False(t, s.IsFinal()) 17 } 18 19 func TestShowWalletPayment_Name(t *testing.T) { 20 s := states.ShowWalletPayment{} 21 assert.Equal(t, "ShowWalletPayment", s.Name()) 22 } 23 24 func TestShowWalletPayment_Rollback(t *testing.T) { 25 s := states.ShowWalletPayment{} 26 assert.Nil(t, s.Rollback(context.Background(), nil)) 27 } 28 29 func TestShowWalletPayment_Run(t *testing.T) { 30 s := states.ShowWalletPayment{} 31 isCalled := false 32 s.Inject(nil, func(_ context.Context, _ *process.Process, _ *application.PaymentService) process.RunResult { 33 isCalled = true 34 return process.RunResult{} 35 }) 36 37 s.Run(context.Background(), nil) 38 39 assert.True(t, isCalled) 40 } 41 42 func TestNewShowWalletPaymentStateData(t *testing.T) { 43 assert.Equal(t, 44 process.StateData(states.ShowWalletPaymentData{ 45 UsedPaymentMethod: "test", 46 }), 47 states.NewShowWalletPaymentStateData(states.ShowWalletPaymentData{ 48 UsedPaymentMethod: "test", 49 }), 50 ) 51 }