diff --git a/pkg/object/splitinfo.go b/pkg/object/splitinfo.go index cbe7162..38ae308 100644 --- a/pkg/object/splitinfo.go +++ b/pkg/object/splitinfo.go @@ -13,6 +13,12 @@ func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo { return (*SplitInfo)(v2) } +// NewSplitInfo creates and initializes blank SplitInfo. +// +// Defaults: +// - splitID: nil; +// - lastPart nil; +// - link: nil. func NewSplitInfo() *SplitInfo { return NewSplitInfoFromV2(new(object.SplitInfo)) } diff --git a/pkg/object/splitinfo_test.go b/pkg/object/splitinfo_test.go index 6238710..500f5ba 100644 --- a/pkg/object/splitinfo_test.go +++ b/pkg/object/splitinfo_test.go @@ -68,3 +68,21 @@ func TestSplitInfo_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewSplitInfo(t *testing.T) { + t.Run("default values", func(t *testing.T) { + si := object.NewSplitInfo() + + // check initial values + require.Nil(t, si.SplitID()) + require.Nil(t, si.LastPart()) + require.Nil(t, si.Link()) + + // convert to v2 message + siV2 := si.ToV2() + + require.Nil(t, siV2.GetSplitID()) + require.Nil(t, siV2.GetLastPart()) + require.Nil(t, siV2.GetLink()) + }) +}