fix(backend): Format
This commit is contained in:
@@ -23,7 +23,6 @@ class InitialApplicationFormSeeder(
|
||||
private val versionService: ApplicationFormVersionService,
|
||||
private val splitYamlLoader: SplitYamlLoader,
|
||||
) : ApplicationRunner {
|
||||
|
||||
override fun run(args: ApplicationArguments) {
|
||||
seedInitialFormIfMissing()
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ class InitialApplicationFormTemplateSeeder(
|
||||
private val userRepository: UserRepository,
|
||||
private val splitYamlLoader: SplitYamlLoader,
|
||||
) : ApplicationRunner {
|
||||
|
||||
override fun run(args: ApplicationArguments) {
|
||||
seedInitialTemplateIfMissing()
|
||||
}
|
||||
|
||||
@@ -40,7 +40,10 @@ class SplitYamlLoader {
|
||||
return processIncludes(mainContent, baseDir)
|
||||
}
|
||||
|
||||
private fun processIncludes(content: String, baseDir: String): String {
|
||||
private fun processIncludes(
|
||||
content: String,
|
||||
baseDir: String,
|
||||
): String {
|
||||
val result = StringBuilder()
|
||||
|
||||
content.lines().forEach { line ->
|
||||
@@ -61,9 +64,13 @@ class SplitYamlLoader {
|
||||
return result.toString()
|
||||
}
|
||||
|
||||
private fun indentContent(content: String, indent: String): String {
|
||||
private fun indentContent(
|
||||
content: String,
|
||||
indent: String,
|
||||
): String {
|
||||
val lines = content.lines()
|
||||
return lines.mapIndexed { index, line ->
|
||||
return lines
|
||||
.mapIndexed { index, line ->
|
||||
when {
|
||||
index == 0 -> "- $line" // First line gets the list marker
|
||||
line.isBlank() -> line
|
||||
|
||||
@@ -4,12 +4,12 @@ import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.assertDoesNotThrow
|
||||
|
||||
class SplitYamlLoaderTest {
|
||||
|
||||
@Test
|
||||
fun `loads template form from split files`() {
|
||||
val loader = SplitYamlLoader()
|
||||
|
||||
val form = assertDoesNotThrow {
|
||||
val form =
|
||||
assertDoesNotThrow {
|
||||
loader.loadApplicationForm("seed/template/_main.yaml")
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ class SplitYamlLoaderTest {
|
||||
fun `loads demo form from split files`() {
|
||||
val loader = SplitYamlLoader()
|
||||
|
||||
val form = assertDoesNotThrow {
|
||||
val form =
|
||||
assertDoesNotThrow {
|
||||
loader.loadApplicationForm("seed/demo/_main.yaml")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user