Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 23, 2023
1 parent 33ef46f commit 46e9cad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ import cc.unitmesh.core.Instruction

interface TypedIns {
val type: CompletionBuilderType

fun unique(): Instruction
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import cc.unitmesh.core.unittest.TypedTestIns
import cc.unitmesh.core.unittest.TestCodeBuilder
import cc.unitmesh.pick.worker.job.JobContext
import chapi.domain.core.CodeDataStruct
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json

class ClassTestCodeBuilder(private val context: JobContext) : TestCodeBuilder {
/**
Expand Down Expand Up @@ -49,7 +51,7 @@ class ClassTestIns(
* the Specification of the test
*/
val specs: List<String> = listOf(),
val relatedCode: List<String> = listOf(),
private val relatedCode: List<String> = listOf(),
override val testType: TestCodeBuilderType,
) : TypedTestIns() {
override fun unique(): Instruction {
Expand Down Expand Up @@ -79,10 +81,13 @@ class ClassTestIns(
input.append(underTestCode)
input.append("\n```")

return Instruction(
val instruction = Instruction(
instruction = "Write unit test for following code.",
input = input.toString(),
output = generatedCode,
)

println("ClassTestIns: ${Json.encodeToString(instruction)}")
return instruction
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProjectLibraryTest {
val testStack = ProjectLibrary.prepare(language, deps)

// then
assertEquals("Spring MVC, Spring WebFlux", testStack.coreFrameworks())
assertEquals("Spring Boot Test, Spring Test", testStack.testFrameworks())
assertEquals("Spring MVC, Spring WebFlux", testStack.coreFrameworks().joinToString(", "))
assertEquals("Spring Boot Test, Spring Test", testStack.testFrameworks().joinToString(", "))
}
}

0 comments on commit 46e9cad

Please sign in to comment.