Skip to content

Commit f121044

Browse files
committed
fix(common, validator): validate in correct order
1 parent d2e1df1 commit f121044

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

feature/validator/src/commonMain/kotlin/com/neoutils/neoregex/feature/validator/ValidatorViewModel.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ class ValidatorViewModel(
115115
setupTestCasesListener()
116116
}
117117

118+
private fun initialTestCase() {
119+
if (testCasesRepository.all.isEmpty()) {
120+
TestCase().also { emptyTestCase ->
121+
testCasesRepository.set(emptyTestCase)
122+
expanded.value = emptyTestCase.uuid
123+
}
124+
}
125+
}
126+
118127
private fun setupTestCasesListener() = screenModelScope.launch {
119128
testCasesRepository.flow.collectLatest { testCases ->
120129
testCases.forEach { testCase ->
@@ -137,15 +146,6 @@ class ValidatorViewModel(
137146
}
138147
}
139148

140-
private fun initialTestCase() {
141-
if (testCasesRepository.all.isEmpty()) {
142-
TestCase().also { emptyTestCase ->
143-
testCasesRepository.set(emptyTestCase)
144-
expanded.value = emptyTestCase.uuid
145-
}
146-
}
147-
}
148-
149149
private fun setupPatternListener() = screenModelScope.launch {
150150
testPattern.collectLatest { testPattern ->
151151

@@ -160,7 +160,7 @@ class ValidatorViewModel(
160160
testCaseQueue.enqueue(
161161
testCasesRepository.all.filterNot {
162162
it.text.isEmpty()
163-
}.reversed()
163+
}
164164
)
165165
}
166166
}

feature/validator/src/commonMain/kotlin/com/neoutils/neoregex/feature/validator/usecase/ValidateUseCase.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.neoutils.neoregex.core.common.model.Match
2222
import com.neoutils.neoregex.core.common.model.TestCase
2323
import com.neoutils.neoregex.feature.validator.model.TestCaseValidation
2424
import kotlinx.coroutines.Dispatchers
25+
import kotlinx.coroutines.delay
2526
import kotlinx.coroutines.withContext
2627

2728
class ValidateUseCase {

0 commit comments

Comments
 (0)