Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package events_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/ignite/cli/v29/ignite/pkg/events"
|
|
)
|
|
|
|
func TestNew(t *testing.T) {
|
|
msg := "message"
|
|
cases := []struct {
|
|
name, message string
|
|
inProgress, hasIcon bool
|
|
options []events.Option
|
|
event events.Event
|
|
}{
|
|
{
|
|
name: "event",
|
|
event: events.Event{},
|
|
},
|
|
{
|
|
name: "event start",
|
|
message: msg,
|
|
inProgress: true,
|
|
options: []events.Option{events.ProgressStart()},
|
|
event: events.New(msg, events.ProgressStart()),
|
|
},
|
|
{
|
|
name: "event update",
|
|
message: msg,
|
|
inProgress: true,
|
|
options: []events.Option{events.ProgressUpdate()},
|
|
event: events.New(msg, events.ProgressUpdate()),
|
|
},
|
|
{
|
|
name: "event finish",
|
|
message: msg,
|
|
options: []events.Option{events.ProgressFinish()},
|
|
event: events.New(msg, events.ProgressFinish()),
|
|
},
|
|
}
|
|
for _, tt := range cases {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
// Act
|
|
e := events.New(tt.message, tt.options...)
|
|
|
|
// Assert
|
|
require.Equal(t, tt.event, e)
|
|
require.Equal(t, tt.inProgress, e.InProgress())
|
|
})
|
|
}
|
|
}
|