Skip to content

Commit

Permalink
update TestSchema_CopyFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
nourbalaha committed Dec 23, 2024
1 parent 2fac5ce commit d2f3636
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/pkg/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,14 @@ func TestSchema_HasFieldByKey(t *testing.T) {

func TestSchema_CopyFrom(t *testing.T) {
fid := id.NewFieldID()
s1 := &Schema{id: id.NewSchemaID(), fields: []*Field{{id: id.NewFieldID(), name: "f1", key: id.NewKey("K123123")}}, titleField: fid.Ref()}
s2 := &Schema{id: id.NewSchemaID(), fields: []*Field{{}}}
s1 := &Schema{id: id.NewSchemaID(), fields: []*Field{{id: id.NewFieldID(), name: "f1", key: id.RandomKey()}}, titleField: fid.Ref()}
s2 := &Schema{id: id.NewSchemaID(), fields: []*Field{}}
s2.CopyFrom(s1)
assert.Equal(t, s1.fields, s2.fields)
assert.Equal(t, s1.titleField, s2.titleField)

s3 := &Schema{id: id.NewSchemaID(), fields: []*Field{}}
s3.CopyFrom(nil)
assert.Equal(t, 0, len(s3.fields))
assert.Nil(t, s3.titleField)
}

0 comments on commit d2f3636

Please sign in to comment.