summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-09-21 18:29:08 +0000
committerClaude <noreply@anthropic.com>2026-09-21 18:29:08 +0000
commit2ce4d50eb8b17c751d347865473f9895edecd938 (patch)
treef9ba19a9413611d74a115c9f4826960a3aef2fef /app/src
parentcabe26374ef047c93bcebed83d70923631910fc0 (diff)
Pin the reported NPR page shape with a regression test
Verified end to end on device against the actual URL from the bug report: npr.org/podcasts/510318/up-first resolves to feeds.npr.org/510318/podcast.xml and subscribes as 'Up First from NPR' with 500 episodes. The page carries two rel="alternate" links: the RSS feed, and an android-app:// deep link with no type attribute at all. Requiring a recognised feed type is what keeps the deep link from being chosen -- it would resolve to something unfetchable. That was already the behaviour; it now has a test naming the case, since "we happen to filter on type" and "we must filter on type" look identical until something changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
Diffstat (limited to 'app/src')
-rw-r--r--app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt b/app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt
index 55e33b2..26d3857 100644
--- a/app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt
+++ b/app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt
@@ -94,6 +94,24 @@ class FeedResolverTest {
!failed.message.contains("START_DOCUMENT") && !failed.message.contains("InputStreamReader"))
}
+ /**
+ * The page from the bug report, reproduced: NPR declares its feed, but also carries a
+ * second rel="alternate" with no type at all (an android-app:// deep link). Picking that
+ * one would resolve to something unfetchable.
+ */
+ @Test
+ fun `ignores an alternate link with no type`() = runTest {
+ val html = """
+ <!DOCTYPE html><html><head>
+ <link rel='alternate' href='android-app://org.npr.one/nprone/view?aggId=510318' />
+ <link rel="alternate" type="application/rss+xml" title="Up First" href="${url("/rss")}" />
+ </head><body>Up First</body></html>
+ """.trimIndent()
+ server.enqueue(MockResponse().setHeader("Content-Type", "text/html").setBody(html))
+
+ assertEquals(FeedResolver.Resolution.Feed(url("/rss")), resolve(url("/podcasts/510318/up-first")))
+ }
+
@Test
fun `a 404 reports the status rather than a parse error`() = runTest {
server.enqueue(MockResponse().setResponseCode(404))