test: postのテストを追加

This commit is contained in:
usbharu 2024-06-05 12:07:58 +09:00
parent 2c298d2d26
commit f794095ecf
1 changed files with 20 additions and 0 deletions

View File

@ -143,6 +143,24 @@ class PostTest {
} }
} }
@Test
fun ゔvisibilityがDIRECT以外の時visibleActorsを変更できない() {
val post = TestPostFactory.create(visibility = Visibility.FOLLOWERS)
post.visibleActors = setOf(ActorId(100))
assertEmpty(post)
val post2 = TestPostFactory.create(visibility = Visibility.UNLISTED)
post2.visibleActors = setOf(ActorId(100))
assertEmpty(post2)
val post3 = TestPostFactory.create(visibility = Visibility.PUBLIC)
post3.visibleActors = setOf(ActorId(100))
assertEmpty(post3)
}
@Test @Test
fun visibilityがDIRECTの時visibleActorsを変更できる() { fun visibilityがDIRECTの時visibleActorsを変更できる() {
val post = TestPostFactory.create(visibility = Visibility.DIRECT) val post = TestPostFactory.create(visibility = Visibility.DIRECT)
@ -191,4 +209,6 @@ class PostTest {
post.content = PostContent("test", "test", emptyList()) post.content = PostContent("test", "test", emptyList())
assertContainsEvent(post, PostEvent.update.eventName) assertContainsEvent(post, PostEvent.update.eventName)
} }
} }