mirror of https://github.com/usbharu/Hideout.git
test: RelationshipTest.ktを追加
This commit is contained in:
parent
22084ee4be
commit
b52839192c
|
@ -28,24 +28,6 @@ class RelationshipTest {
|
||||||
assertContainsEvent(relationship, RelationshipEvent.UNFOLLOW_REQUEST.eventName)
|
assertContainsEvent(relationship, RelationshipEvent.UNFOLLOW_REQUEST.eventName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun block_unfollowされblockが発生する() {
|
|
||||||
val relationship = Relationship(
|
|
||||||
actorId = ActorId(1),
|
|
||||||
targetActorId = ActorId(2),
|
|
||||||
following = true,
|
|
||||||
blocking = false,
|
|
||||||
muting = false,
|
|
||||||
followRequesting = false,
|
|
||||||
mutingFollowRequest = false
|
|
||||||
)
|
|
||||||
|
|
||||||
relationship.block()
|
|
||||||
|
|
||||||
assertTrue(relationship.blocking)
|
|
||||||
assertContainsEvent(relationship, RelationshipEvent.BLOCK.eventName)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun mute_MUTEが発生する() {
|
fun mute_MUTEが発生する() {
|
||||||
val relationship = Relationship(
|
val relationship = Relationship(
|
||||||
|
@ -116,25 +98,55 @@ class RelationshipTest {
|
||||||
assertFalse(relationship.mutingFollowRequest)
|
assertFalse(relationship.mutingFollowRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun followRequest_followRequestingがtrueになりFOLLOW_REQUESTが発生する() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun followRequest_ブロックしている場合はフォローリクエストを送れない() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun unfollowRequest_followRequestingがfalseになりUNFOLLOW_REQUESTが発生する() {
|
fun unfollowRequest_followRequestingがfalseになりUNFOLLOW_REQUESTが発生する() {
|
||||||
|
val relationship = Relationship(
|
||||||
|
ActorId(1),
|
||||||
|
targetActorId = ActorId(2),
|
||||||
|
following = false,
|
||||||
|
blocking = false,
|
||||||
|
muting = false,
|
||||||
|
followRequesting = true,
|
||||||
|
mutingFollowRequest = false
|
||||||
|
)
|
||||||
|
|
||||||
|
relationship.unfollowRequest()
|
||||||
|
|
||||||
|
assertFalse(relationship.followRequesting)
|
||||||
|
assertContainsEvent(relationship, RelationshipEvent.UNFOLLOW_REQUEST.eventName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun acceptFollowRequest_followingがtrueにfollowRequestingがfalseになりaccept_followが発生する() {
|
fun acceptFollowRequest_followingがtrueにfollowRequestingがfalseになりaccept_followが発生する() {
|
||||||
|
val relationship = Relationship(
|
||||||
|
actorId = ActorId(1),
|
||||||
|
targetActorId = ActorId(2),
|
||||||
|
following = false,
|
||||||
|
blocking = false,
|
||||||
|
muting = false,
|
||||||
|
followRequesting = true,
|
||||||
|
mutingFollowRequest = true
|
||||||
|
)
|
||||||
|
|
||||||
|
relationship.acceptFollowRequest()
|
||||||
|
assertTrue(relationship.following)
|
||||||
|
assertContainsEvent(relationship, RelationshipEvent.ACCEPT_FOLLOW.eventName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun rejectFollowRequest_followRequestingがfalseになりREJECT_FOLLOWが発生する() {
|
||||||
|
val relationship = Relationship(
|
||||||
|
actorId = ActorId(1),
|
||||||
|
targetActorId = ActorId(2),
|
||||||
|
following = false,
|
||||||
|
blocking = false,
|
||||||
|
muting = false,
|
||||||
|
followRequesting = true,
|
||||||
|
mutingFollowRequest = false
|
||||||
|
)
|
||||||
|
|
||||||
|
relationship.rejectFollowRequest()
|
||||||
|
assertFalse(relationship.followRequesting)
|
||||||
|
assertContainsEvent(relationship, RelationshipEvent.REJECT_FOLLOW.eventName)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -464,7 +464,7 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
mutingFollowRequest = false,
|
mutingFollowRequest = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
relationship.block()
|
relationship.mute()
|
||||||
|
|
||||||
repository.save(relationship)
|
repository.save(relationship)
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
followRequesting = false,
|
followRequesting = false,
|
||||||
mutingFollowRequest = false,
|
mutingFollowRequest = false,
|
||||||
)
|
)
|
||||||
relationship.block()
|
relationship.mute()
|
||||||
|
|
||||||
repository.delete(relationship)
|
repository.delete(relationship)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue