Skip to content

Commit

Permalink
Merge pull request #6527 from grzesiek2010/COLLECT-6518
Browse files Browse the repository at this point in the history
Do not create entities with blank labels
  • Loading branch information
seadowg authored Nov 22, 2024
2 parents 9bcfd13 + 7d09fb7 commit 26f6a5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object LocalEntityUseCases {
if (id != null) {
when (formEntity.action) {
EntityAction.CREATE -> {
if (!label.isNullOrEmpty()) {
if (!label.isNullOrBlank()) {
val entity = Entity.New(
id,
label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class LocalEntityUseCasesTest {
}

@Test
fun `updateLocalEntitiesFromForm updates properties and does not change label on update if label is empty`() {
fun `updateLocalEntitiesFromForm updates properties and does not change label on update if label is blank`() {
entitiesRepository.save(
"things",
Entity.New(
Expand All @@ -120,7 +120,7 @@ class LocalEntityUseCasesTest {
)

val formEntity =
FormEntity(EntityAction.UPDATE, "things", "id", "", listOf("prop" to "value 2"))
FormEntity(EntityAction.UPDATE, "things", "id", " ", listOf("prop" to "value 2"))
val formEntities = EntitiesExtra(listOf(formEntity))

LocalEntityUseCases.updateLocalEntitiesFromForm(formEntities, entitiesRepository)
Expand Down Expand Up @@ -189,9 +189,9 @@ class LocalEntityUseCasesTest {
}

@Test
fun `updateLocalEntitiesFromForm does not create entity that has an empty label`() {
fun `updateLocalEntitiesFromForm does not create entity that has a blank label`() {
val formEntity =
FormEntity(EntityAction.CREATE, "things", "1", "", emptyList())
FormEntity(EntityAction.CREATE, "things", "1", " ", emptyList())
val formEntities = EntitiesExtra(listOf(formEntity))
entitiesRepository.addList("things")

Expand Down

0 comments on commit 26f6a5b

Please sign in to comment.