You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
However, there's an issue testing any handler methods that invoke ApplicationCall#receiveText() like CreateExchange and SubmitMessage. Mocking this is proving difficult.
Example test written (currently not being run)
fun`verify callback is invoked upon successful rfq submission`() = runBlocking {
// todo ApplicationCall.receiveText() is an extension function// need to find another way to mock it
coEvery { applicationCall.parameters["exchangeId"] } returns close.metadata.exchangeId
coEvery { applicationCall.receiveText() } returns Json.stringify(close)
coVerify(exactly =1) { submitClose(applicationCall, exchangesApi, any<SubmitCloseCallback>(), close)}
}
Example error stack:
SubmitMessageTest > SubmitMessageMockkTest > verify callback is invoked upon successful rfq submission() FAILED
io.ktor.server.plugins.CannotTransformContentToTypeException: Cannot transform this request's content to io.ktor.utils.io.ByteReadChannel
at app//io.ktor.server.request.ApplicationReceiveFunctionsKt.receiveNullable(ApplicationReceiveFunctions.kt:107)
at app//tbdex.sdk.httpserver.handlers.SubmitMessageTest$SubmitMessageMockkTest$verify callback is invoked upon successful rfq submission$1$2.invokeSuspend(SubmitMessageTest.kt:117)
at app//tbdex.sdk.httpserver.handlers.SubmitMessageTest$SubmitMessageMockkTest$verify callback is invoked upon successful rfq submission$1$2.invoke(SubmitMessageTest.kt)
at app//tbdex.sdk.httpserver.handlers.SubmitMessageTest$SubmitMessageMockkTest$verify callback is invoked upon successful rfq submission$1$2.invoke(SubmitMessageTest.kt)...
Maybe using
mockk
library will helpThe text was updated successfully, but these errors were encountered: