Some checks failed
Docs Deploy / build_and_deploy (push) Has been cancelled
Generate Docs / cli (push) Has been cancelled
Generate Config Doc / cli (push) Has been cancelled
Go formatting / go-formatting (push) Has been cancelled
Check links / markdown-link-check (push) Has been cancelled
Integration / pre-test (push) Has been cancelled
Integration / test on (push) Has been cancelled
Integration / status (push) Has been cancelled
Lint / Lint Go code (push) Has been cancelled
Test / test (ubuntu-latest) (push) Has been cancelled
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package events_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"git.cw.tr/mukan-network/mukan-ignite/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())
|
|
})
|
|
}
|
|
}
|