mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 10:37:05 +05:30
paparazzi-tests: add test for LobstersCard
This commit is contained in:
parent
5e3bc96493
commit
eb00c7b8c5
3 changed files with 48 additions and 0 deletions
|
@ -0,0 +1,48 @@
|
|||
package dev.msfjarvis.claw.android.tests
|
||||
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import app.cash.paparazzi.Paparazzi
|
||||
import com.google.testing.junit.testparameterinjector.TestParameter
|
||||
import com.google.testing.junit.testparameterinjector.TestParameterInjector
|
||||
import dev.msfjarvis.claw.common.posts.LobstersCard
|
||||
import dev.msfjarvis.claw.common.posts.PostActions
|
||||
import dev.msfjarvis.claw.database.local.SavedPost
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(TestParameterInjector::class)
|
||||
class LobstersCardTest {
|
||||
@get:Rule val paparazzi = Paparazzi()
|
||||
companion object {
|
||||
private val post =
|
||||
SavedPost(
|
||||
shortId = "shortId",
|
||||
title = "Title",
|
||||
url = "/s/shortId",
|
||||
createdAt = "2021-04-03T16:16:02.000-05:00",
|
||||
commentCount = 10,
|
||||
commentsUrl = "/s/shortId",
|
||||
submitterName = "msfjarvis",
|
||||
submitterAvatarUrl = "/msfjarvis.png",
|
||||
tags = listOf("science", "technology"),
|
||||
)
|
||||
private val postActions =
|
||||
object : PostActions {
|
||||
override fun viewPost(postUrl: String, commentsUrl: String) {}
|
||||
|
||||
override fun viewComments(postId: String) {}
|
||||
|
||||
override fun viewCommentsPage(commentsUrl: String) {}
|
||||
|
||||
override fun toggleSave(post: SavedPost) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun verify(@TestParameter theme: Theme) {
|
||||
paparazzi.snapshot {
|
||||
MaterialTheme(colorScheme = theme.colors) { LobstersCard(post, false, postActions) }
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Loading…
Add table
Add a link
Reference in a new issue