From e45259603bb48bf120e47bac02472daeb8f74cb3 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 30 Mar 2023 03:36:43 +0200 Subject: [PATCH] transport/channel_test.go: dont test Action Channel with String() method. just compare Channel objects. --- transport/channel_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/transport/channel_test.go b/transport/channel_test.go index 81c3f5a..4b606b9 100644 --- a/transport/channel_test.go +++ b/transport/channel_test.go @@ -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) } })