Add domain test

pull/17/head
Koitharu 4 years ago
parent 4710bd9f02
commit 878a37590b
No known key found for this signature in database
GPG Key ID: 8E861F8CE6E7CE27

@ -1,6 +1,8 @@
package org.koitharu.kotatsu.parsers package org.koitharu.kotatsu.parsers
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import okhttp3.HttpUrl
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.ParameterizedTest
@ -123,6 +125,20 @@ internal class MangaParserTest {
checkImageRequest(faviconUrl, null) checkImageRequest(faviconUrl, null)
} }
@ParameterizedTest
@MangaSources
fun domain(source: MangaSource) = runTest {
val parser = source.newParser(context)
val defaultDomain = parser.getDomain()
val url = HttpUrl.Builder()
.host(defaultDomain)
.scheme("https")
.toString()
val response = context.doRequest(url)
val realDomain = response.request.url.host
assertEquals(defaultDomain, realDomain)
}
@ParameterizedTest @ParameterizedTest
@MangaSources @MangaSources
@Disabled @Disabled

Loading…
Cancel
Save