Skip to content

Commit acd74b3

Browse files
committed
fix: tests
1 parent a22dfc8 commit acd74b3

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/tags/TagsControllerComplexOperationTest.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TagsControllerComplexOperationTest : ProjectAuthControllerTest("/v2/projec
4949
(null to "no tag key") to listOf("other tag"),
5050
(null to "existing tag key 2") to listOf("existing tag 2", "other tag"),
5151
// branched key keeps untouched
52-
(null to "branch key") to listOf("existing tag"),
52+
(null to "branch key") to listOf("existing tag 2"),
5353
),
5454
)
5555
}
@@ -72,7 +72,7 @@ class TagsControllerComplexOperationTest : ProjectAuthControllerTest("/v2/projec
7272
(null to "test key") to listOf("test", "existing tag", "existing tag 2", "new tag"),
7373
(null to "no tag key") to listOf("other tag"),
7474
(null to "existing tag key 2") to listOf("existing tag 2", "new tag"),
75-
(null to "branch key") to listOf("existing tag"),
75+
(null to "branch key") to listOf("existing tag 2"),
7676
),
7777
)
7878
}
@@ -139,7 +139,7 @@ class TagsControllerComplexOperationTest : ProjectAuthControllerTest("/v2/projec
139139
(null to "test key") to listOf("test", "existing tag 2"),
140140
(null to "no tag key") to listOf(),
141141
(null to "existing tag key 2") to listOf(),
142-
(null to "branch key") to listOf("existing tag"),
142+
(null to "branch key") to listOf("existing tag 2"),
143143
),
144144
)
145145
}
@@ -162,7 +162,7 @@ class TagsControllerComplexOperationTest : ProjectAuthControllerTest("/v2/projec
162162
(null to "test key") to listOf("test"),
163163
(null to "no tag key") to listOf(),
164164
(null to "existing tag key 2") to listOf(),
165-
(null to "branch key") to listOf("existing tag"),
165+
(null to "branch key") to listOf("existing tag 2"),
166166
),
167167
)
168168
}
@@ -293,14 +293,14 @@ class TagsControllerComplexOperationTest : ProjectAuthControllerTest("/v2/projec
293293
performProjectAuthPut(
294294
"tag-complex?branch=feature",
295295
mapOf(
296-
"filterTag" to listOf("existing tag"),
296+
"filterTag" to listOf("existing tag 2"),
297297
"tagFiltered" to listOf("branch only"),
298298
),
299299
).andIsOk
300300

301301
assertKeyTags(
302302
mapOf(
303-
(null to "branch key") to listOf("existing tag", "branch only"),
303+
(null to "branch key") to listOf("existing tag 2", "branch only"),
304304
// others keep untouched
305305
(null to "test key") to listOf("test", "existing tag", "existing tag 2"),
306306
("namespace" to "namespaced key") to listOf("existing tag"),
@@ -325,7 +325,7 @@ class TagsControllerComplexOperationTest : ProjectAuthControllerTest("/v2/projec
325325

326326
assertKeyTags(
327327
mapOf(
328-
(null to "branch key") to listOf("existing tag", "branch only"),
328+
(null to "branch key") to listOf("existing tag 2", "branch only"),
329329
// others keep untouched
330330
(null to "test key") to listOf("test", "existing tag", "existing tag 2"),
331331
("namespace" to "namespaced key") to listOf("existing tag"),

backend/data/src/main/kotlin/io/tolgee/development/testDataBuilder/data/TagsTestData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TagsTestData : BaseTestData("tagsTestUser", "tagsTestProject") {
4444
branchKey = this
4545
}.build {
4646
addMeta {
47-
tags.add(existingTag)
47+
tags.add(existingTag2)
4848
}
4949
}
5050
}

backend/data/src/main/kotlin/io/tolgee/service/branching/AbstractBranchService.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ abstract class AbstractBranchService(
3333
override fun getDefaultBranch(projectId: Long): Branch? {
3434
return branchRepository.findDefaultByProjectId(projectId)
3535
}
36+
37+
override fun deleteAllByProjectId(projectId: Long) {
38+
return branchRepository.deleteAllByProjectId(projectId)
39+
}
3640
}

backend/data/src/main/kotlin/io/tolgee/service/branching/BranchService.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,6 @@ interface BranchService {
119119
)
120120

121121
fun enableBranchingOnProject(projectId: Long)
122+
123+
fun deleteAllByProjectId(projectId: Long)
122124
}

backend/data/src/main/kotlin/io/tolgee/service/project/ProjectHardDeletingService.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import io.tolgee.service.AvatarService
1313
import io.tolgee.service.GlossaryCleanupService
1414
import io.tolgee.service.PromptService
1515
import io.tolgee.service.bigMeta.BigMetaService
16+
import io.tolgee.service.branching.BranchService
1617
import io.tolgee.service.dataImport.ImportService
1718
import io.tolgee.service.dataImport.ImportSettingsService
1819
import io.tolgee.service.key.KeyService
@@ -54,6 +55,7 @@ class ProjectHardDeletingService(
5455
private val importSettingsService: ImportSettingsService,
5556
private val glossaryCleanupService: GlossaryCleanupService,
5657
private val labelService: LabelService,
58+
private val branchService: BranchService,
5759
) : Logging {
5860
@Transactional
5961
@CacheEvict(cacheNames = [Caches.PROJECTS], key = "#project.id")
@@ -112,6 +114,7 @@ class ProjectHardDeletingService(
112114
avatarService.unlinkAvatarFiles(project)
113115
batchJobService.deleteAllByProjectId(project.id)
114116
bigMetaService.deleteAllByProjectId(project.id)
117+
branchService.deleteAllByProjectId(project.id)
115118
projectRepository.delete(project)
116119
}
117120
}

0 commit comments

Comments
 (0)