1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-07-02 11:43:40 +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 { tests := []struct {
name string name string
ch Channel action Action
want string want Channel
}{ }{
{"Empty", Action{}.Channel(), "actions"}, {"Empty", Action{}, Channel{"actions"}},
{"Contract", Action{Contract: "mycontract"}.Channel(), "actions/contract/mycontract"}, {"Contract", Action{Contract: "mycontract"}, Channel{"actions", "contract", "mycontract"}},
{"Action", Action{Name: "myaction"}.Channel(), "actions/name/myaction"}, {"Action", Action{Name: "myaction"}, Channel{"actions", "name", "myaction"}},
{"ContractAndName", Action{Contract: "mycontract", Name: "myaction"}.Channel(), "actions/contract/mycontract/name/myaction"}, {"ContractAndName", Action{Contract: "mycontract", Name: "myaction"}, Channel{"actions", "contract", "mycontract", "name", "myaction"}},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { 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) t.Errorf("ActionChannel.String() = %v, want %v", got, tt.want)
} }
}) })