From 788ada2330f96ca247f7dfd189099fca2ad45624 Mon Sep 17 00:00:00 2001 From: jasonkarel Date: Wed, 13 Nov 2024 12:53:01 +0700 Subject: [PATCH 1/6] chore: Increase domain package unit test coverage (event and schema) --- server/pkg/integrationapi/event_test.go | 155 +++++++++++++++++++++++ server/pkg/integrationapi/schema_test.go | 112 ++++++++++++++++ 2 files changed, 267 insertions(+) create mode 100644 server/pkg/integrationapi/event_test.go create mode 100644 server/pkg/integrationapi/schema_test.go diff --git a/server/pkg/integrationapi/event_test.go b/server/pkg/integrationapi/event_test.go new file mode 100644 index 000000000..da5159cb6 --- /dev/null +++ b/server/pkg/integrationapi/event_test.go @@ -0,0 +1,155 @@ +package integrationapi + +import ( + "testing" + "time" + + "github.com/reearth/reearth-cms/server/pkg/asset" + "github.com/reearth/reearth-cms/server/pkg/event" + "github.com/reearth/reearth-cms/server/pkg/id" + "github.com/reearth/reearth-cms/server/pkg/operator" + "github.com/reearth/reearth-cms/server/pkg/project" + "github.com/reearth/reearthx/account/accountdomain" + "github.com/reearth/reearthx/account/accountdomain/user" + "github.com/stretchr/testify/assert" +) + +func Test_NewOperator(t *testing.T) { + + uid := accountdomain.NewUserID() + integrationID := id.NewIntegrationID() + // machineID := + opUser := operator.OperatorFromUser(uid) + opIntegration := operator.OperatorFromIntegration(integrationID) + opMachine := operator.OperatorFromMachine() + tests := []struct { + name string + input operator.Operator + want Operator + }{ + { + name: "success user operator", + input: opUser, + want: Operator{ + User: &OperatorUser{ + ID: uid.String(), + }, + }, + }, + { + name: "success integration operator", + input: opIntegration, + want: Operator{ + Integration: &OperatorIntegration{ + ID: integrationID.String(), + }, + }, + }, + { + name: "success machine operator", + input: opMachine, + want: Operator{ + Machine: &OperatorMachine{}, + }, + }, + { + name: "success unknown operator", + input: operator.Operator{}, + want: Operator{}, + }, + } + for _, test := range tests { + result := NewOperator(test.input) + if !assert.Equal(t, result, test.want) { + t.Errorf("expected %+v but got %+v", test.want, result) + } + } +} + +func TestNewEventWith(t *testing.T) { + now := time.Now() + u := user.New().NewID().Email("hoge@example.com").Name("John").MustBuild() + a := asset.New().NewID().Project(project.NewID()).Size(100).NewUUID(). + CreatedByUser(u.ID()).Thread(id.NewThreadID()).MustBuild() + eID1 := event.NewID() + prj := event.Project{ + ID: "testID", + Alias: "testAlias", + } + + ev := event.New[any]().ID(eID1).Timestamp(now).Type(event.AssetCreate).Operator(operator.OperatorFromUser(u.ID())).Object(a).Project(&prj).MustBuild() + d1, _ := New(ev, "test", func(a *asset.Asset) string { + return "test.com" + }) + d2, _ := New(ev.Object(), "test", func(a *asset.Asset) string { + return "test.com" + }) + type args struct { + event *event.Event[any] + override any + v string + urlResolver asset.URLResolver + } + tests := []struct { + name string + args args + want Event + wantErr error + }{ + { + name: "success", + args: args{ + event: ev, + override: ev, + v: "test", + urlResolver: func(a *asset.Asset) string { + return "test.com" + }, + }, + want: Event{ + ID: ev.ID().String(), + Type: string(ev.Type()), + Timestamp: ev.Timestamp(), + Data: d1, + Project: &ProjectIdAlias{ + ID: ev.Project().ID, + Alias: ev.Project().Alias, + }, + Operator: NewOperator(ev.Operator()), + }, + wantErr: nil, + }, + { + name: "success when override is nil", + args: args{ + event: ev, + override: nil, + v: "test", + urlResolver: func(a *asset.Asset) string { + return "test.com" + }, + }, + want: Event{ + ID: ev.ID().String(), + Type: string(ev.Type()), + Timestamp: ev.Timestamp(), + Data: d2, + Project: &ProjectIdAlias{ + ID: ev.Project().ID, + Alias: ev.Project().Alias, + }, + Operator: NewOperator(ev.Operator()), + }, + wantErr: nil, + }, + } + for _, test := range tests { + result, err := NewEventWith(test.args.event, test.args.override, test.args.v, test.args.urlResolver) + if !assert.Equal(t, result, test.want) { + t.Errorf("expected %+v but got %+v", test.want, result) + } + if !assert.Equal(t, err, test.wantErr) { + t.Errorf("expected %+v but got %+v", test.wantErr, err) + } + } +} diff --git a/server/pkg/integrationapi/schema_test.go b/server/pkg/integrationapi/schema_test.go new file mode 100644 index 000000000..374e72b7f --- /dev/null +++ b/server/pkg/integrationapi/schema_test.go @@ -0,0 +1,112 @@ +package integrationapi + +import ( + "testing" + "time" + + "github.com/reearth/reearth-cms/server/pkg/id" + "github.com/reearth/reearth-cms/server/pkg/model" + "github.com/reearth/reearth-cms/server/pkg/schema" + "github.com/reearth/reearthx/account/accountdomain" + "github.com/reearth/reearthx/util" + "github.com/samber/lo" + "github.com/stretchr/testify/assert" +) + +func TestNewModel(t *testing.T) { + type args struct { + m *model.Model + sp *schema.Package + lastModified time.Time + } + timeNow := time.Now() + pID := id.NewProjectID() + sf1 := schema.NewField(schema.NewText(nil).TypeProperty()).NewID().RandomKey().MustBuild() + sf2 := schema.NewField(lo.Must1(schema.NewInteger(nil, nil)).TypeProperty()).NewID().RandomKey().MustBuild() + s1 := schema.New().NewID().Project(pID).Workspace(accountdomain.NewWorkspaceID()).Fields([]*schema.Field{sf1, sf2}).MustBuild() + s2 := schema.New().NewID().Project(pID).Workspace(accountdomain.NewWorkspaceID()).Fields([]*schema.Field{sf1, sf2}).TitleField(sf1.ID().Ref()).MustBuild() + schemaPackage1 := schema.NewPackage(s1, nil, nil, nil) + schemaPackage2 := schema.NewPackage(s2, nil, nil, nil) + model1 := model.New().ID(id.NewModelID()).Metadata(s1.ID().Ref()).Project(pID).Schema(s1.ID()).Key(id.NewKey("mmm123")).UpdatedAt(timeNow).MustBuild() + model2 := model.New().ID(id.NewModelID()).Metadata(s2.ID().Ref()).Project(pID).Schema(s2.ID()).Key(id.NewKey("mmm123")).UpdatedAt(timeNow).MustBuild() + + tests := []struct { + name string + args args + want Model + }{ + { + name: "success", + args: args{ + m: model1, + sp: schemaPackage1, + lastModified: timeNow, + }, + want: Model{ + Id: model1.ID().Ref(), + Key: util.ToPtrIfNotEmpty(model1.Key().String()), + Name: util.ToPtrIfNotEmpty(model1.Name()), + Description: util.ToPtrIfNotEmpty(model1.Description()), + Public: util.ToPtrIfNotEmpty(model1.Public()), + ProjectId: model1.Project().Ref(), + SchemaId: model1.Schema().Ref(), + Schema: util.ToPtrIfNotEmpty(NewSchema(schemaPackage1.Schema())), + MetadataSchemaId: model1.Metadata().Ref(), + MetadataSchema: util.ToPtrIfNotEmpty(NewSchema(schemaPackage1.MetaSchema())), + CreatedAt: lo.ToPtr(model1.ID().Timestamp()), + UpdatedAt: lo.ToPtr(model1.UpdatedAt()), + LastModified: util.ToPtrIfNotEmpty(timeNow), + }, + }, + { + name: "success with item field in schema", + args: args{ + m: model2, + sp: schemaPackage2, + lastModified: timeNow, + }, + want: Model{ + Id: model2.ID().Ref(), + Key: util.ToPtrIfNotEmpty(model2.Key().String()), + Name: util.ToPtrIfNotEmpty(model2.Name()), + Description: util.ToPtrIfNotEmpty(model2.Description()), + Public: util.ToPtrIfNotEmpty(model2.Public()), + ProjectId: model2.Project().Ref(), + SchemaId: model2.Schema().Ref(), + Schema: util.ToPtrIfNotEmpty(NewSchema(schemaPackage2.Schema())), + MetadataSchemaId: model2.Metadata().Ref(), + MetadataSchema: util.ToPtrIfNotEmpty(NewSchema(schemaPackage2.MetaSchema())), + CreatedAt: lo.ToPtr(model2.ID().Timestamp()), + UpdatedAt: lo.ToPtr(model2.UpdatedAt()), + LastModified: util.ToPtrIfNotEmpty(timeNow), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := NewModel(tt.args.m, tt.args.sp, tt.args.lastModified) + if result != tt.want { + assert.Equal(t, result, tt.want) + } + }) + } +} + +// func TestNewItemFieldChanges(t *testing.T) { +// type args struct { +// change item.FieldChange +// } + +// tests := []struct{ +// name string +// args args +// want []FieldChange +// }{ +// { +// name: "success", +// args: args{ +// change: item.FieldChanges{}, +// }, +// }, +// } +// } From cfb1d99211385d513664b46e24e52f9bd7984f30 Mon Sep 17 00:00:00 2001 From: jasonkarel Date: Wed, 20 Nov 2024 12:57:04 +0700 Subject: [PATCH 2/6] add ut for schema_test --- server/pkg/integrationapi/schema_test.go | 71 +++++++++++++++++------- 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/server/pkg/integrationapi/schema_test.go b/server/pkg/integrationapi/schema_test.go index 374e72b7f..f4e197e90 100644 --- a/server/pkg/integrationapi/schema_test.go +++ b/server/pkg/integrationapi/schema_test.go @@ -5,8 +5,10 @@ import ( "time" "github.com/reearth/reearth-cms/server/pkg/id" + "github.com/reearth/reearth-cms/server/pkg/item" "github.com/reearth/reearth-cms/server/pkg/model" "github.com/reearth/reearth-cms/server/pkg/schema" + "github.com/reearth/reearth-cms/server/pkg/value" "github.com/reearth/reearthx/account/accountdomain" "github.com/reearth/reearthx/util" "github.com/samber/lo" @@ -85,28 +87,57 @@ func TestNewModel(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { result := NewModel(tt.args.m, tt.args.sp, tt.args.lastModified) - if result != tt.want { - assert.Equal(t, result, tt.want) - } + assert.Equal(t, tt.want, result) }) } } -// func TestNewItemFieldChanges(t *testing.T) { -// type args struct { -// change item.FieldChange -// } +func TestNewItemFieldChanges(t *testing.T) { -// tests := []struct{ -// name string -// args args -// want []FieldChange -// }{ -// { -// name: "success", -// args: args{ -// change: item.FieldChanges{}, -// }, -// }, -// } -// } + fID := id.NewFieldID() + v0 := value.MultipleFrom(value.TypeBool, []*value.Value{ + value.New(value.TypeBool, false), + }) + v1 := value.MultipleFrom(value.TypeBool, []*value.Value{ + value.New(value.TypeBool, true), + }) + + type args struct { + change item.FieldChanges + } + + tests := []struct { + name string + args args + want []FieldChange + }{ + { + name: "success", + args: args{ + change: item.FieldChanges{ + item.FieldChange{ + ID: fID, + Type: item.FieldChangeTypeAdd, + CurrentValue: value.MultipleFrom(v1.Type(), []*value.Value{v1.First()}), + PreviousValue: value.MultipleFrom(v0.Type(), []*value.Value{v0.First()}), + }, + }, + }, + want: []FieldChange{ + { + ID: fID, + Type: item.FieldChangeTypeAdd, + CurrentValue: v1.Interface(), + PreviousValue: v0.Interface(), + }, + }, + }, + } + for _, test := range tests { + t.Run(string(test.name), func(t *testing.T) { + t.Parallel() + result := NewItemFieldChanges(test.args.change) + assert.Equal(t, test.want, result) + }) + } +} From 588a86552ff82e9a48489406d1887ca9f3e60014 Mon Sep 17 00:00:00 2001 From: jasonkarel Date: Wed, 20 Nov 2024 12:59:54 +0700 Subject: [PATCH 3/6] fix mocTime for UT --- server/pkg/integrationapi/event_test.go | 5 ++--- server/pkg/integrationapi/schema_test.go | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/server/pkg/integrationapi/event_test.go b/server/pkg/integrationapi/event_test.go index da5159cb6..c098600be 100644 --- a/server/pkg/integrationapi/event_test.go +++ b/server/pkg/integrationapi/event_test.go @@ -18,7 +18,6 @@ func Test_NewOperator(t *testing.T) { uid := accountdomain.NewUserID() integrationID := id.NewIntegrationID() - // machineID := opUser := operator.OperatorFromUser(uid) opIntegration := operator.OperatorFromIntegration(integrationID) opMachine := operator.OperatorFromMachine() @@ -67,7 +66,7 @@ func Test_NewOperator(t *testing.T) { } func TestNewEventWith(t *testing.T) { - now := time.Now() + mockTime := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) u := user.New().NewID().Email("hoge@example.com").Name("John").MustBuild() a := asset.New().NewID().Project(project.NewID()).Size(100).NewUUID(). CreatedByUser(u.ID()).Thread(id.NewThreadID()).MustBuild() @@ -77,7 +76,7 @@ func TestNewEventWith(t *testing.T) { Alias: "testAlias", } - ev := event.New[any]().ID(eID1).Timestamp(now).Type(event.AssetCreate).Operator(operator.OperatorFromUser(u.ID())).Object(a).Project(&prj).MustBuild() + ev := event.New[any]().ID(eID1).Timestamp(mockTime).Type(event.AssetCreate).Operator(operator.OperatorFromUser(u.ID())).Object(a).Project(&prj).MustBuild() d1, _ := New(ev, "test", func(a *asset.Asset) string { return "test.com" }) diff --git a/server/pkg/integrationapi/schema_test.go b/server/pkg/integrationapi/schema_test.go index f4e197e90..7e0c7ac39 100644 --- a/server/pkg/integrationapi/schema_test.go +++ b/server/pkg/integrationapi/schema_test.go @@ -21,7 +21,7 @@ func TestNewModel(t *testing.T) { sp *schema.Package lastModified time.Time } - timeNow := time.Now() + mockTime := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) pID := id.NewProjectID() sf1 := schema.NewField(schema.NewText(nil).TypeProperty()).NewID().RandomKey().MustBuild() sf2 := schema.NewField(lo.Must1(schema.NewInteger(nil, nil)).TypeProperty()).NewID().RandomKey().MustBuild() @@ -29,8 +29,8 @@ func TestNewModel(t *testing.T) { s2 := schema.New().NewID().Project(pID).Workspace(accountdomain.NewWorkspaceID()).Fields([]*schema.Field{sf1, sf2}).TitleField(sf1.ID().Ref()).MustBuild() schemaPackage1 := schema.NewPackage(s1, nil, nil, nil) schemaPackage2 := schema.NewPackage(s2, nil, nil, nil) - model1 := model.New().ID(id.NewModelID()).Metadata(s1.ID().Ref()).Project(pID).Schema(s1.ID()).Key(id.NewKey("mmm123")).UpdatedAt(timeNow).MustBuild() - model2 := model.New().ID(id.NewModelID()).Metadata(s2.ID().Ref()).Project(pID).Schema(s2.ID()).Key(id.NewKey("mmm123")).UpdatedAt(timeNow).MustBuild() + model1 := model.New().ID(id.NewModelID()).Metadata(s1.ID().Ref()).Project(pID).Schema(s1.ID()).Key(id.NewKey("mmm123")).UpdatedAt(mockTime).MustBuild() + model2 := model.New().ID(id.NewModelID()).Metadata(s2.ID().Ref()).Project(pID).Schema(s2.ID()).Key(id.NewKey("mmm123")).UpdatedAt(mockTime).MustBuild() tests := []struct { name string @@ -42,7 +42,7 @@ func TestNewModel(t *testing.T) { args: args{ m: model1, sp: schemaPackage1, - lastModified: timeNow, + lastModified: mockTime, }, want: Model{ Id: model1.ID().Ref(), @@ -57,7 +57,7 @@ func TestNewModel(t *testing.T) { MetadataSchema: util.ToPtrIfNotEmpty(NewSchema(schemaPackage1.MetaSchema())), CreatedAt: lo.ToPtr(model1.ID().Timestamp()), UpdatedAt: lo.ToPtr(model1.UpdatedAt()), - LastModified: util.ToPtrIfNotEmpty(timeNow), + LastModified: util.ToPtrIfNotEmpty(mockTime), }, }, { @@ -65,7 +65,7 @@ func TestNewModel(t *testing.T) { args: args{ m: model2, sp: schemaPackage2, - lastModified: timeNow, + lastModified: mockTime, }, want: Model{ Id: model2.ID().Ref(), @@ -80,7 +80,7 @@ func TestNewModel(t *testing.T) { MetadataSchema: util.ToPtrIfNotEmpty(NewSchema(schemaPackage2.MetaSchema())), CreatedAt: lo.ToPtr(model2.ID().Timestamp()), UpdatedAt: lo.ToPtr(model2.UpdatedAt()), - LastModified: util.ToPtrIfNotEmpty(timeNow), + LastModified: util.ToPtrIfNotEmpty(mockTime), }, }, } From 27ed976b6a03408f395b87eea1e7bf0d4d38c552 Mon Sep 17 00:00:00 2001 From: jasonkarel Date: Wed, 20 Nov 2024 14:25:56 +0700 Subject: [PATCH 4/6] fix ut mechanism --- server/pkg/integrationapi/event_test.go | 30 +++++++++++++++--------- server/pkg/integrationapi/schema_test.go | 1 + 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/server/pkg/integrationapi/event_test.go b/server/pkg/integrationapi/event_test.go index c098600be..2f36918fa 100644 --- a/server/pkg/integrationapi/event_test.go +++ b/server/pkg/integrationapi/event_test.go @@ -58,10 +58,14 @@ func Test_NewOperator(t *testing.T) { }, } for _, test := range tests { - result := NewOperator(test.input) - if !assert.Equal(t, result, test.want) { - t.Errorf("expected %+v but got %+v", test.want, result) - } + t.Run(test.name, func(t *testing.T) { + t.Parallel() + result := NewOperator(test.input) + if !assert.Equal(t, result, test.want) { + t.Errorf("expected %+v but got %+v", test.want, result) + } + }) + } } @@ -143,12 +147,16 @@ func TestNewEventWith(t *testing.T) { }, } for _, test := range tests { - result, err := NewEventWith(test.args.event, test.args.override, test.args.v, test.args.urlResolver) - if !assert.Equal(t, result, test.want) { - t.Errorf("expected %+v but got %+v", test.want, result) - } - if !assert.Equal(t, err, test.wantErr) { - t.Errorf("expected %+v but got %+v", test.wantErr, err) - } + t.Run(test.name, func(t *testing.T) { + t.Parallel() + + result, err := NewEventWith(test.args.event, test.args.override, test.args.v, test.args.urlResolver) + if !assert.Equal(t, result, test.want) { + t.Errorf("expected %+v but got %+v", test.want, result) + } + if !assert.Equal(t, err, test.wantErr) { + t.Errorf("expected %+v but got %+v", test.wantErr, err) + } + }) } } diff --git a/server/pkg/integrationapi/schema_test.go b/server/pkg/integrationapi/schema_test.go index 7e0c7ac39..b5adbb580 100644 --- a/server/pkg/integrationapi/schema_test.go +++ b/server/pkg/integrationapi/schema_test.go @@ -86,6 +86,7 @@ func TestNewModel(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() result := NewModel(tt.args.m, tt.args.sp, tt.args.lastModified) assert.Equal(t, tt.want, result) }) From dfb75cbc7d867cb7e5fa2b2b35ff07824cfe29f9 Mon Sep 17 00:00:00 2001 From: jasonkarel Date: Wed, 20 Nov 2024 14:40:53 +0700 Subject: [PATCH 5/6] add error case in NewEvenWith --- server/pkg/integrationapi/event_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/pkg/integrationapi/event_test.go b/server/pkg/integrationapi/event_test.go index 2f36918fa..0771a872b 100644 --- a/server/pkg/integrationapi/event_test.go +++ b/server/pkg/integrationapi/event_test.go @@ -81,6 +81,7 @@ func TestNewEventWith(t *testing.T) { } ev := event.New[any]().ID(eID1).Timestamp(mockTime).Type(event.AssetCreate).Operator(operator.OperatorFromUser(u.ID())).Object(a).Project(&prj).MustBuild() + ev1 := event.New[any]().ID(eID1).Timestamp(mockTime).Type(event.Type("test")).Operator(operator.OperatorFromUser(u.ID())).Object("test").Project(&prj).MustBuild() d1, _ := New(ev, "test", func(a *asset.Asset) string { return "test.com" }) @@ -145,6 +146,17 @@ func TestNewEventWith(t *testing.T) { }, wantErr: nil, }, + { + name: "error new returns error", + args: args{ + event: ev, + override: ev1, + v: "", + urlResolver: nil, + }, + want: Event{}, + wantErr: ErrUnsupportedEntity, + }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { From f8b59f827ab6d60428509e94f304bb8593bbe323 Mon Sep 17 00:00:00 2001 From: jasonkarel Date: Fri, 22 Nov 2024 17:04:34 +0700 Subject: [PATCH 6/6] add item package ut --- server/pkg/id/id_test.go | 12 ++++++++++++ server/pkg/id/key_test.go | 11 +++++++++++ server/pkg/item/builder_test.go | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/server/pkg/id/id_test.go b/server/pkg/id/id_test.go index ef2bebb78..51a31e938 100644 --- a/server/pkg/id/id_test.go +++ b/server/pkg/id/id_test.go @@ -55,4 +55,16 @@ func TestAsset_Type(t *testing.T) { r := Resource{} assert.Equal(t, "resource", r.Type()) + + v := View{} + assert.Equal(t, "request", v.Type()) + + tag := Tag{} + assert.Equal(t, "tag", tag.Type()) + + g := Group{} + assert.Equal(t, "group", g.Type()) + + ig := ItemGroup{} + assert.Equal(t, "item_group", ig.Type()) } diff --git a/server/pkg/id/key_test.go b/server/pkg/id/key_test.go index fcddc667f..6c70356da 100644 --- a/server/pkg/id/key_test.go +++ b/server/pkg/id/key_test.go @@ -55,3 +55,14 @@ func TestKey_Clone(t *testing.T) { assert.Equal(t, k, c) assert.NotSame(t, k, c) } + +func TestKey_NewKeyFromPtr(t *testing.T) { + + str := "test-key" + wantKey := Key{ + key: lo.FromPtr(&str), + } + result := NewKeyFromPtr(&str) + assert.NotNil(t, result, "Result should not be nil") + assert.Equal(t, &wantKey, result, "Key value should match the input string") +} diff --git a/server/pkg/item/builder_test.go b/server/pkg/item/builder_test.go index 69140737a..9a63bc410 100644 --- a/server/pkg/item/builder_test.go +++ b/server/pkg/item/builder_test.go @@ -219,3 +219,21 @@ func TestBuilder_IsMetadata(t *testing.T) { b := New().IsMetadata(true) assert.Equal(t, true, b.i.isMetadata) } + +func TestBuilder_UpdatedByUser(t *testing.T) { + uId := accountdomain.NewUserID() + uuid := New().UpdatedByUser(&uId) + assert.Equal(t, &uId, uuid.i.updatedByUser) +} + +func TestBuilder_UpdatedByIntegration(t *testing.T) { + iid := id.NewIntegrationID() + uuid := New().UpdatedByIntegration(&iid) + assert.Equal(t, &iid, uuid.i.updatedByIntegration) +} + +func TestBuilder_OriginalItem(t *testing.T) { + iId := id.NewItemID().Ref() + b := New().OriginalItem(iId) + assert.Equal(t, iId, b.i.originalItem) +}