diff --git a/pkg/netmap/replica.go b/pkg/netmap/replica.go index b9bae5dd..9bceb7fd 100644 --- a/pkg/netmap/replica.go +++ b/pkg/netmap/replica.go @@ -8,6 +8,10 @@ import ( type Replica netmap.Replica // NewReplica creates and returns new Replica instance. +// +// Defaults: +// - count: 0; +// - selector: "". func NewReplica() *Replica { return NewReplicaFromV2(new(netmap.Replica)) } diff --git a/pkg/netmap/replica_test.go b/pkg/netmap/replica_test.go index 9c6d5a9c..c1b0dba1 100644 --- a/pkg/netmap/replica_test.go +++ b/pkg/netmap/replica_test.go @@ -81,3 +81,19 @@ func TestReplica_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewReplica(t *testing.T) { + t.Run("default values", func(t *testing.T) { + r := NewReplica() + + // check initial values + require.Zero(t, r.Count()) + require.Empty(t, r.Selector()) + + // convert to v2 message + rV2 := r.ToV2() + + require.Zero(t, rV2.GetCount()) + require.Empty(t, rV2.GetSelector()) + }) +}