Hello all. Just signed up for this Slack channel. ...
# server
a
Hello all. Just signed up for this Slack channel. I'm stuck and need a little help. I have firebase auth setup in ktor and working except in my unit testing. Getting
TRACE io.ktor.auth.jwt - Failed to get JWK: Failed to get key with kid null
Trying to figure out if this is a problem with creating a custom Token:
Copy code
test("when register for game and userId is not found then NotFound is returned") {
            coEvery { userRepositoryMock.getUser(any()) } returns null
            withServer {
                val req = handleRequest(HttpMethod.Get, "/api/game/1/2") {
                    addJwtHeader()
                }
                req.response.status() shouldBe HttpStatusCode.NotFound
                req.response.content shouldBe "Could not find user."
            }
        }

private fun TestApplicationRequest.addJwtHeader() = addHeader("Authorization", "Bearer ${getToken()}")

private fun getToken() = FirebaseAuth.getInstance().createCustomToken(UUID.randomUUID().toString())

@ExperimentalCoroutinesApi
@KtorExperimentalAPI
@ExperimentalTime
private fun withServer(block: TestApplicationEngine.() -> Unit) {
    withTestApplication({ module() }, block)
}
Appreciate any advice that can be offered.