diff --git a/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipTest.kt b/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipTest.kt index 7a299558..7a9c514b 100644 --- a/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipTest.kt +++ b/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipTest.kt @@ -28,24 +28,6 @@ class RelationshipTest { 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 fun mute_MUTEが発生する() { val relationship = Relationship( @@ -116,25 +98,55 @@ class RelationshipTest { assertFalse(relationship.mutingFollowRequest) } - @Test - fun followRequest_followRequestingがtrueになりFOLLOW_REQUESTが発生する() { - - } - - @Test - fun followRequest_ブロックしている場合はフォローリクエストを送れない() { - - } - @Test 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 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) + } } \ No newline at end of file diff --git a/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedRelationshipRepositoryTest.kt b/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedRelationshipRepositoryTest.kt index 8220d6a2..01d0f5ef 100644 --- a/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedRelationshipRepositoryTest.kt +++ b/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedRelationshipRepositoryTest.kt @@ -464,7 +464,7 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships) mutingFollowRequest = false, ) - relationship.block() + relationship.mute() repository.save(relationship) @@ -492,7 +492,7 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships) followRequesting = false, mutingFollowRequest = false, ) - relationship.block() + relationship.mute() repository.delete(relationship)