Skip to content

Instantly share code, notes, and snippets.

@perbu
Created August 7, 2020 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perbu/2cbd5d5e26a9f082bd5a51dd1608ee95 to your computer and use it in GitHub Desktop.
Save perbu/2cbd5d5e26a9f082bd5a51dd1608ee95 to your computer and use it in GitHub Desktop.
package integration
import io.ktor.application.Application
import io.ktor.http.HttpMethod
import io.ktor.http.HttpStatusCode
import io.ktor.server.testing.TestApplicationEngine
import io.ktor.server.testing.handleRequest
import io.ktor.server.testing.withTestApplication
import ombruk.backend.module
import org.junit.Test
import kotlin.test.assertEquals
class ApplicationTest {
companion object {
var app = TestApplicationEngine {
}
}
@Test
fun test1() {
assertEquals(1, 1)
}
@Test
fun testHealth() = withTestApplication({
module(true)
}) {
with(handleRequest(HttpMethod.Get, "/health_check") {
addHeader("Foo", "Bar")
}) {
assertEquals(HttpStatusCode.OK, this.response.status())
}
}.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment