Skip to content

Commit

Permalink
setup kotest
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrele committed Jan 26, 2022
1 parent 37f7064 commit 553146e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
7 changes: 7 additions & 0 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ repositories {
dependencies {
val ktorVersion = "1.6.2"
val koinVersion = "3.1.5"
val kotestVersion = "5.1.0"

implementation("io.ktor:ktor-metrics-micrometer:$ktorVersion")
implementation("io.ktor:ktor-serialization:$ktorVersion")
Expand All @@ -53,6 +54,12 @@ dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-test:1.6.10")
testImplementation("io.mockk:mockk:1.12.0")
testImplementation("org.apache.kafka:kafka-streams-test-utils:2.8.1")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
}

tasks.withType<Test> {
useJUnitPlatform()
}

tasks.withType<Jar> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package no.nav.mulighetsrommet.api

import io.ktor.application.Application
import io.ktor.http.HttpMethod
import io.ktor.server.testing.handleRequest
import io.ktor.server.testing.withTestApplication
import org.junit.Test
import io.kotest.core.spec.style.FunSpec
import io.ktor.application.*
import io.ktor.http.*
import io.ktor.server.testing.*
import kotlin.test.assertEquals

class ApplicationTest {

@Test
fun `should be alive`() {
withTestApplication(Application::module) {
handleRequest(HttpMethod.Get, "/internal/ping").apply {
assertEquals("PONG", response.content)
class ApplicationTest : FunSpec({
context("ping") {
test("should respond with pong") {
withTestApplication(Application::module) {
handleRequest(HttpMethod.Get, "/internal/ping").apply {
assertEquals("PONG", response.content)
}
}
}
}
}
})

0 comments on commit 553146e

Please sign in to comment.