prysm-pulse/proto/migration/enums_test.go
Raul Jordan d077483577
Add V3 Suffix to All Prysm Packages (#11083)
* v3 import renamings

* tidy

* fmt

* rev

* Update beacon-chain/core/epoch/precompute/reward_penalty_test.go

* Update beacon-chain/core/helpers/validators_test.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/iface/BUILD.bazel

* Update beacon-chain/db/kv/kv.go

* Update beacon-chain/db/kv/state.go

* Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go

* Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go

* Update beacon-chain/sync/initial-sync/service.go

* fix deps

* fix bad replacements

* fix bad replacements

* change back

* gohashtree version

* fix deps

Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: Potuz <potuz@prysmaticlabs.com>
2022-08-16 12:20:13 +00:00

83 lines
2.0 KiB
Go

package migration
import (
"testing"
v1 "github.com/prysmaticlabs/prysm/v3/proto/eth/v1"
eth "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
)
func TestV1Alpha1ConnectionStateToV1(t *testing.T) {
tests := []struct {
name string
connState eth.ConnectionState
want v1.ConnectionState
}{
{
name: "DISCONNECTED",
connState: eth.ConnectionState_DISCONNECTED,
want: v1.ConnectionState_DISCONNECTED,
},
{
name: "CONNECTED",
connState: eth.ConnectionState_CONNECTED,
want: v1.ConnectionState_CONNECTED,
},
{
name: "CONNECTING",
connState: eth.ConnectionState_CONNECTING,
want: v1.ConnectionState_CONNECTING,
},
{
name: "DISCONNECTING",
connState: eth.ConnectionState_DISCONNECTING,
want: v1.ConnectionState_DISCONNECTING,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := V1Alpha1ConnectionStateToV1(tt.connState); got != tt.want {
t.Errorf("V1Alpha1ConnectionStateToV1() = %v, want %v", got, tt.want)
}
})
}
}
func TestV1Alpha1PeerDirectionToV1(t *testing.T) {
tests := []struct {
name string
peerDirection eth.PeerDirection
want v1.PeerDirection
wantErr bool
}{
{
name: "UNKNOWN",
peerDirection: eth.PeerDirection_UNKNOWN,
want: 0,
wantErr: true,
},
{
name: "INBOUND",
peerDirection: eth.PeerDirection_INBOUND,
want: v1.PeerDirection_INBOUND,
},
{
name: "OUTBOUND",
peerDirection: eth.PeerDirection_OUTBOUND,
want: v1.PeerDirection_OUTBOUND,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := V1Alpha1PeerDirectionToV1(tt.peerDirection)
if (err != nil) != tt.wantErr {
t.Errorf("V1Alpha1PeerDirectionToV1() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("V1Alpha1PeerDirectionToV1() got = %v, want %v", got, tt.want)
}
})
}
}