flamingo.me/flamingo-commerce/v3@v3.11.0/checkout/domain/placeorder/states/show_iframe_test.go (about) 1 package states_test 2 3 import ( 4 "context" 5 "net/url" 6 "testing" 7 8 "flamingo.me/flamingo-commerce/v3/checkout/domain/placeorder/process" 9 "flamingo.me/flamingo-commerce/v3/checkout/domain/placeorder/states" 10 "flamingo.me/flamingo-commerce/v3/payment/application" 11 12 "github.com/stretchr/testify/assert" 13 ) 14 15 func TestShowIframe_IsFinal(t *testing.T) { 16 s := states.ShowIframe{} 17 assert.False(t, s.IsFinal()) 18 } 19 20 func TestShowIframe_Name(t *testing.T) { 21 s := states.ShowIframe{} 22 assert.Equal(t, "ShowIframe", s.Name()) 23 } 24 25 func TestShowIframe_Rollback(t *testing.T) { 26 s := states.ShowIframe{} 27 assert.Nil(t, s.Rollback(context.Background(), nil)) 28 } 29 30 func TestShowIframe_Run(t *testing.T) { 31 s := states.ShowIframe{} 32 isCalled := false 33 s.Inject(nil, func(_ context.Context, _ *process.Process, _ *application.PaymentService) process.RunResult { 34 isCalled = true 35 return process.RunResult{} 36 }) 37 38 s.Run(context.Background(), nil) 39 40 assert.True(t, isCalled) 41 } 42 43 func TestNewShowIframeStateData(t *testing.T) { 44 assert.Equal(t, process.StateData(&url.URL{Host: "test.com"}), states.NewShowIframeStateData(&url.URL{Host: "test.com"})) 45 }