1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

transport/channel_test.go: dont test Action Channel with String() method. just compare Channel objects.

This commit is contained in:
Henrik Hautakoski 2023-03-30 03:36:43 +02:00
parent f76290f299
commit e45259603b

View file

@ -90,20 +90,20 @@ func TestChannel_String(t *testing.T) {
}
}
func TestActionChannel_String(t *testing.T) {
func TestAction_Channel(t *testing.T) {
tests := []struct {
name string
ch Channel
want string
name string
action Action
want Channel
}{
{"Empty", Action{}.Channel(), "actions"},
{"Contract", Action{Contract: "mycontract"}.Channel(), "actions/contract/mycontract"},
{"Action", Action{Name: "myaction"}.Channel(), "actions/name/myaction"},
{"ContractAndName", Action{Contract: "mycontract", Name: "myaction"}.Channel(), "actions/contract/mycontract/name/myaction"},
{"Empty", Action{}, Channel{"actions"}},
{"Contract", Action{Contract: "mycontract"}, Channel{"actions", "contract", "mycontract"}},
{"Action", Action{Name: "myaction"}, Channel{"actions", "name", "myaction"}},
{"ContractAndName", Action{Contract: "mycontract", Name: "myaction"}, Channel{"actions", "contract", "mycontract", "name", "myaction"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.ch.String(); got != tt.want {
if got := tt.action.Channel(); !got.Is(tt.want) {
t.Errorf("ActionChannel.String() = %v, want %v", got, tt.want)
}
})