mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-18 04:40:03 +02:00
31 lines
965 B
Go
31 lines
965 B
Go
package redis
|
|
|
|
import "testing"
|
|
|
|
func TestKey_String(t *testing.T) {
|
|
type fields struct {
|
|
NS Namespace
|
|
Channel ChannelInterface
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
want string
|
|
}{
|
|
{"Empty", fields{NS: Namespace{}, Channel: Channel{}}, "ship.0000000000000000000000000000000000000000000000000000000000000000::"},
|
|
{"Transactions", fields{NS: Namespace{ChainID: "id"}, Channel: Channel{"transactions"}}, "ship.id::transactions"},
|
|
{"Nested", fields{NS: Namespace{ChainID: "id"}, Channel: Channel{"one.two"}}, "ship.id::one.two"},
|
|
{"Action", fields{NS: Namespace{ChainID: "id"}, Channel: ActionChannel{Contract: "mycontract"}}, "ship.id::actions.contract:mycontract"},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
k := Key{
|
|
NS: tt.fields.NS,
|
|
Channel: tt.fields.Channel,
|
|
}
|
|
if got := k.String(); got != tt.want {
|
|
t.Errorf("Key.String() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|