gaetan
02/09/2018, 10:47 AMzeckson
02/09/2018, 11:09 AMFilipp Riabchun
02/09/2018, 11:12 AMgaetan
02/09/2018, 11:12 AMFilipp Riabchun
02/09/2018, 11:13 AMtesting browser code needs karmaActually, jsdom is often enough for unit tests
gaetan
02/09/2018, 11:14 AMgaetan
02/09/2018, 11:20 AM@Test
    fun loadBigJson() = promise {
        val request = window.fetch(Request("base/build/classes/kotlin/test/ny.json"))
        val response = request.await()
        val text = response.text().await()
        val time = Date.now()
        val featureCollection = text.toGeoJson().asFeatureCollection()
        val multi = featureCollection.multipolygons
        val polygons = multi.flatMap { it.coordinates.toList() }
        assertEquals(108, polygons.size)
    }
I need browser API and not just DOM.zeckson
02/09/2018, 2:06 PMwith coroutines asynch testing?Well as far as I know
mocha supports async/await out of the box, so that’s the only question of setting all it up together. That’s the challenge, but it sounds achievableFilipp Riabchun
02/09/2018, 2:20 PMasync/await is just a sugar for those), and done callback