Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bram-- committed Feb 29, 2024
1 parent 1ca700b commit 9cd98e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/test/kotlin/org/audux/bgg/request/PlaysRequestTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class PlaysRequestTest {
val response =
BggClient.plays(
username = "Novaeux",
id = "123",
id = 123,
page = 1,
subType = SubType.BOARD_GAME,
type = PlayThingType.THING,
Expand Down
12 changes: 6 additions & 6 deletions src/test/kotlin/org/audux/bgg/request/SitemapIndexRequestTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ class SitemapIndexRequestTest {
assertThat(response.data!![SitemapLocationType.BOARD_GAMES]).hasSize(10)
assertThat(response.data!![SitemapLocationType.BOARD_GAME_VERSIONS]).hasSize(9)
assertThat(response.data!![SitemapLocationType.FILES]).hasSize(11)
}
}

@Test
fun `Skips empty responses`() = runBlocking {
val engine = TestUtils.setupMockEngine("sitemapindex", "thread", "thread", "thread")
val engine =
TestUtils.setupMockEngine("sitemapindex.diffuse", "thread", "thread", "thread")
BggClient.engine = { engine }

val response = BggClient.sitemapIndex().diffuse().call()
Expand All @@ -240,12 +241,11 @@ class SitemapIndexRequestTest {
Url("https://boardgamegeek.com/sitemap_geekitems_boardgameversion_page_1"),
Url("https://boardgamegeek.com/sitemap_files_page_1"),
)
assertThat(response.isError()).isTrue()
assertThat(response.isSuccess()).isFalse()
assertThat(response.data).isEmptY()
assertThat(response.isError()).isFalse()
assertThat(response.isSuccess()).isTrue()
assertThat(response.data).isEmpty()
}


private fun MockRequestHandleScope.setupSitemapResponses(requestData: HttpRequestData) =
if (requestData.url.toString().endsWith("sitemapindex")) {
respondOk(String(xml("sitemapindex.diffuse").readAllBytes()))
Expand Down

0 comments on commit 9cd98e4

Please sign in to comment.