diff --git a/pkg/signature.go b/pkg/signature.go index 1847dcd7..09769466 100644 --- a/pkg/signature.go +++ b/pkg/signature.go @@ -17,6 +17,10 @@ func NewSignatureFromV2(sV2 *refs.Signature) *Signature { // NewSignature creates and initializes blank Signature. // // Works similar as NewSignatureFromV2(new(Signature)). +// +// Defaults: +// - key: nil; +// - signature: nil. func NewSignature() *Signature { return NewSignatureFromV2(new(refs.Signature)) } diff --git a/pkg/signature_test.go b/pkg/signature_test.go index 5b8c32f9..45a5f148 100644 --- a/pkg/signature_test.go +++ b/pkg/signature_test.go @@ -1,9 +1,9 @@ package pkg import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" "testing" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -48,3 +48,19 @@ func TestSignature_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewSignature(t *testing.T) { + t.Run("default values", func(t *testing.T) { + sg := NewSignature() + + // check initial values + require.Nil(t, sg.Key()) + require.Nil(t, sg.Sign()) + + // convert to v2 message + sgV2 := sg.ToV2() + + require.Nil(t, sgV2.GetKey()) + require.Nil(t, sgV2.GetSign()) + }) +}