mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-11 18:20:33 +09:00
GO-5294 Fix test
This commit is contained in:
parent
72b82e53b4
commit
c7d0f0aade
2 changed files with 4 additions and 5 deletions
|
@ -187,15 +187,16 @@ func buildDiffDetails(origin, current *domain.Details, isSystem bool) *domain.De
|
|||
diff, _ := domain.StructDiff(current, origin)
|
||||
diff = diff.CopyOnlyKeys(filterKeys...)
|
||||
|
||||
if cannotApplyPluralName(isSystem, diff) {
|
||||
if cannotApplyPluralName(isSystem, current, origin) {
|
||||
diff.Delete(bundle.RelationKeyName)
|
||||
diff.Delete(bundle.RelationKeyPluralName)
|
||||
}
|
||||
return diff
|
||||
}
|
||||
|
||||
func cannotApplyPluralName(isSystem bool, diff *domain.Details) bool {
|
||||
return !isSystem && diff.Has(bundle.RelationKeyName)
|
||||
func cannotApplyPluralName(isSystem bool, current, origin *domain.Details) bool {
|
||||
// we cannot set plural name to custom types with custom name
|
||||
return !isSystem && current.GetString(bundle.RelationKeyName) != origin.GetString(bundle.RelationKeyName)
|
||||
}
|
||||
|
||||
func checkRelationFormatObjectTypes(
|
||||
|
|
|
@ -356,7 +356,6 @@ func TestBuildDiffDetails(t *testing.T) {
|
|||
}), true)
|
||||
|
||||
assert.Equal(t, "Pages", diff.GetString(bundle.RelationKeyPluralName))
|
||||
assert.Equal(t, "Page", diff.GetString(bundle.RelationKeyName))
|
||||
})
|
||||
|
||||
t.Run("new name is applied to custom types, if name was not modified", func(t *testing.T) {
|
||||
|
@ -368,7 +367,6 @@ func TestBuildDiffDetails(t *testing.T) {
|
|||
}), false)
|
||||
|
||||
assert.Equal(t, "Projects", diff.GetString(bundle.RelationKeyPluralName))
|
||||
assert.Equal(t, "Project", diff.GetString(bundle.RelationKeyName))
|
||||
})
|
||||
|
||||
t.Run("new name is NOT applied to custom types, if name was modified", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue