Skip to content

Testing

Peter Araujo edited this page Jul 28, 2024 · 1 revision

General

The ArticApiClient takes an HttpClientEngine. So you can use Ktor testing library's MockEngine to perform mock requests.

Example:

val engine = MockEngine { _: HttpRequestData ->
    respond(
        content = "",
        status = HttpStatusCode.OK,
        headers = headersOf(
            HttpHeaders.ContentType,
            "application/json"
        )
    )
}

val client = ArticApiClient(customEngine = engine)

// Test logic...
Clone this wiki locally