diff --git a/pkg/object/address.go b/pkg/object/address.go index 54d550fd..f1072a9e 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -28,6 +28,10 @@ func NewAddressFromV2(aV2 *refs.Address) *Address { // NewAddress creates and initializes blank Address. // // Works similar as NewAddressFromV2(new(Address)). +// +// Defaults: +// - cid: nil; +// - oid: nil. func NewAddress() *Address { return NewAddressFromV2(new(refs.Address)) } diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index f3b8b35e..6d97cb75 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -101,3 +101,19 @@ func TestAddress_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewAddress(t *testing.T) { + t.Run("default values", func(t *testing.T) { + a := NewAddress() + + // check initial values + require.Nil(t, a.ContainerID()) + require.Nil(t, a.ObjectID()) + + // convert to v2 message + aV2 := a.ToV2() + + require.Nil(t, aV2.GetContainerID()) + require.Nil(t, aV2.GetObjectID()) + }) +}