mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-17 09:47:03 +05:30
lobsters-api: add some more tests
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
6f5d88a5c1
commit
1528231032
1 changed files with 19 additions and 0 deletions
|
@ -7,6 +7,7 @@ import okhttp3.mockwebserver.MockWebServer
|
|||
import okhttp3.mockwebserver.RecordedRequest
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
|
@ -31,6 +32,24 @@ class LobstersApiTest {
|
|||
assertEquals(25, posts.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `no moderator posts in test data`() = runBlocking {
|
||||
val posts = apiClient.getHottestPosts(1)
|
||||
val moderatorPosts = posts.asSequence()
|
||||
.filter { it.submitterUser.isModerator }
|
||||
.toSet()
|
||||
assertTrue(moderatorPosts.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `posts with no urls`() = runBlocking {
|
||||
val posts = apiClient.getHottestPosts(1)
|
||||
val commentsOnlyPosts = posts.asSequence()
|
||||
.filter { it.url.isEmpty() }
|
||||
.toSet()
|
||||
assertEquals(2, commentsOnlyPosts.size)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
webServer.shutdown()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue