From 878a37590bd1c8a7070d22f6a9c45d77457b2553 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Wed, 18 May 2022 10:53:07 +0300 Subject: [PATCH] Add domain test --- .../koitharu/kotatsu/parsers/MangaParserTest.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/kotlin/org/koitharu/kotatsu/parsers/MangaParserTest.kt b/src/test/kotlin/org/koitharu/kotatsu/parsers/MangaParserTest.kt index a0e125b2..347f7593 100644 --- a/src/test/kotlin/org/koitharu/kotatsu/parsers/MangaParserTest.kt +++ b/src/test/kotlin/org/koitharu/kotatsu/parsers/MangaParserTest.kt @@ -1,6 +1,8 @@ package org.koitharu.kotatsu.parsers 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.extension.ExtendWith import org.junit.jupiter.params.ParameterizedTest @@ -123,6 +125,20 @@ internal class MangaParserTest { 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 @MangaSources @Disabled