Testing the index URL

The preceding test case gets an instance of our application and sends a get request on the specified URL, which in this is /, aka an index URL, and it checks if the status is OK - 200 and content is Hello readers!:

    class ApplicationTest {      @Test      fun `check index page`() = withTestApplication(Application::main)        {        with(handleRequest(HttpMethod.Get, "/")) {          assertEquals(HttpStatusCode.OK, response.status())          assertEquals("Hello readers!", response.content)        }      }    }

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.