Skip to content

Commit

Permalink
Failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Feb 21, 2024
1 parent 0d4aa38 commit 314ae4f
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GofeedTest {
@Test
fun testParse() {
val j =
feedergofeed.Feedergofeed.parseBody(
feedergofeed.Feedergofeed.parseBodyString(
"""
<rss version="2.0">
<channel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.nononsenseapps.feeder.model

import com.nononsenseapps.feeder.di.networkModule
import com.nononsenseapps.feeder.model.gofeed.Experiment
import com.nononsenseapps.feeder.util.getOrElse
import com.nononsenseapps.jsonfeed.cachingHttpClient
import kotlinx.coroutines.runBlocking
import okhttp3.MediaType.Companion.toMediaTypeOrNull
Expand Down Expand Up @@ -65,20 +66,23 @@ class FeedParserTest : DIAware {
fun canParseUkrnet() {
runBlocking {
readResource("rss_ukrnet.xml") {
val feed = exp.parseBody(it)
// val feed = exp.parseBody(it)
//
// val feed =
// feedParser.parseFeedResponse(
// URL("https://suspilne.media/rss/ukrnet.rss"),
// it,
// null,
// )

// feed.leftOrNull()?.throwable?.let { t ->
// throw t
// }

assertEquals(20, feed?.items?.size, "Expected 20 items")

// assertEquals(20, feed?.items?.size, "Expected 20 items")

val feed =
feedParser.parseFeedResponse(
URL("https://suspilne.media/rss/ukrnet.rss"),
it,
null,
)

feed.leftOrNull()?.throwable?.let { t ->
throw t
}

assertEquals(20, feed.getOrNull()?.items?.size, "Expected 20 items")
}
}
}
Expand Down Expand Up @@ -725,7 +729,11 @@ class FeedParserTest : DIAware {
@Throws(Exception::class)
fun londoner() =
runBlocking {
val feed = londoner.use { feedParser.parseFeedResponse(it) }.getOrNull()!!
val feed =
londoner.use { feedParser.parseFeedResponse(it) }.getOrElse {
System.err.println(it)
throw it.throwable!!
}

assertEquals("http://londonist.com/", feed.home_page_url)
assertEquals("http://londonist.com/feed", feed.feed_url)
Expand Down
Loading

0 comments on commit 314ae4f

Please sign in to comment.