Skip to content

Commit

Permalink
test: realign with sys reqmts
Browse files Browse the repository at this point in the history
  • Loading branch information
tyknkd committed May 24, 2024
1 parent 76f4ca9 commit 1486e1b
Showing 1 changed file with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ApplicationTest {
assertEquals(HttpStatusCode.OK, status)
val bodyAsText = bodyAsText()
assertContains(bodyAsText,"Tech Industry News Analyzer")
assertContains(bodyAsText,"articles")
assertContains(bodyAsText,"tech industry news articles")
assertContains(bodyAsText,"href=\"/\"")
}
}
Expand Down Expand Up @@ -107,19 +107,36 @@ class ApplicationTest {
val bodyAsText = bodyAsText()
assertContains(bodyAsText,"Tech Industry News Analyzer")
assertContains(bodyAsText,"Topic Group 0")
assertContains(bodyAsText,"More on this topic")
assertContains(bodyAsText,"\"/topics/1/articles\"")
assertContains(bodyAsText,"Topic Group 1")
assertContains(bodyAsText,"href=\"/topics/1/articles\"")
for (article in TestDoubles.analyzedArticles) {
assertContains(bodyAsText,article.title)
assertContains(bodyAsText,article.url)
}
assertContains(bodyAsText,"href=\"${TestDoubles.analyzedArticles[0].url}\"")
}
}
@Test
fun testTopics() = testSuspend {
testClient.get("/topics").apply {
assertEquals(HttpStatusCode.OK, status)
val bodyAsText = bodyAsText()
assertContains(bodyAsText,"Tech Industry News Analyzer")
assertContains(bodyAsText,"Topic Group 0")
assertContains(bodyAsText,"Topic Group 1")
assertContains(bodyAsText,"href=\"/\"")
assertContains(bodyAsText,"href=\"/topics/1/articles\"")
}
}
@Test
fun testTopic0Articles() = testSuspend {
testClient.get("/topics/0/articles").apply {
assertEquals(HttpStatusCode.OK, status)
val bodyAsText = bodyAsText()
assertContains(bodyAsText,"Tech Industry News Analyzer")
assertContains(bodyAsText,"Topic Group 0")
assertContains(bodyAsText,"href=\"/\"")
assertContains(bodyAsText,"\"/topics/1/articles\"")
assertContains(bodyAsText,"href=\"https://www.example.com/")
}
}
companion object {
Expand Down

0 comments on commit 1486e1b

Please sign in to comment.