Trying to get my iosTests working. When I run allT...
# multiplatform
a
Trying to get my iosTests working. When I run allTests, many tests fail, and these are all related to server stuff For example, we have this test:
Copy code
@Test
fun testDownloadCompletedSuccessfully() {
    runBlocking {
        launch(Dispatchers.Main) {
            val result = retriever.fetchData()
            assertEquals(RemoteResultType.SUCCESS, result.type)
        }
    }
}
which does this:
Copy code
override suspend fun fetchData(): RemoteDataResult {
    val responseContent: String
    return try {
        responseContent = httpClient.get { url(hostURL + serviceURL) }.body()
        RemoteDataResult(responseContent, RemoteResultType.SUCCESS)
    } catch (e: ClientRequestException) {
        return RemoteDataResult(e.message, RemoteResultType.CLIENT_ERROR)
    } catch (e: ServerResponseException) {
        return RemoteDataResult(e.message, RemoteResultType.SERVER_ERROR)
    } catch (e: Exception) {
        return RemoteDataResult(e.message, RemoteResultType.GENERAL_ERROR)
    }
}
But it always returns as GENERAL_ERROR. I tried debugging and it says this: Exception in http request: Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “run.mocky.io” which could put your confidential information at risk." We do have some test endpoints on mocky to simulate stuff like 500 errors etc. How can I work around this?
n
👋 Did you ever figure this out?