Link Search Menu Expand Document

How to test write an end to end test

You can start the server in the test, call routes and make assertions, then you can stop the server. Extension method http is provided by Topinambur.

import topinambur.http

@Test
fun `say hello`() {
    HttpServer()
        .get("/*") { _, res -> res.write("Hello") }
        .start().use {
            assertThat("http://localhost:4545/".http.get().body).isEqualTo("Hello")
        }
}

An Open Source Project