diff --git a/src/test/kotlin/dev/usbharu/hideout/core/service/post/PostServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/core/service/post/PostServiceImplTest.kt index 9ebbae81..8efae4ec 100644 --- a/src/test/kotlin/dev/usbharu/hideout/core/service/post/PostServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/core/service/post/PostServiceImplTest.kt @@ -5,6 +5,7 @@ import dev.usbharu.hideout.application.config.CharacterLimit import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.post.Post import dev.usbharu.hideout.core.domain.model.post.PostRepository +import dev.usbharu.hideout.core.domain.model.reaction.ReactionRepository import dev.usbharu.hideout.core.query.PostQueryService import dev.usbharu.hideout.core.service.timeline.TimelineService import kotlinx.coroutines.test.runTest @@ -45,6 +46,9 @@ class PostServiceImplTest { @Mock private lateinit var apSendCreateService: ApSendCreateService + @Mock + private lateinit var reactionRepository: ReactionRepository + @InjectMocks private lateinit var postServiceImpl: PostServiceImpl diff --git a/src/test/kotlin/dev/usbharu/hideout/core/service/user/ActorServiceTest.kt b/src/test/kotlin/dev/usbharu/hideout/core/service/user/ActorServiceTest.kt index 9d5b6f10..d41e7e32 100644 --- a/src/test/kotlin/dev/usbharu/hideout/core/service/user/ActorServiceTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/core/service/user/ActorServiceTest.kt @@ -4,9 +4,11 @@ package dev.usbharu.hideout.core.service.user import dev.usbharu.hideout.application.config.ApplicationConfig import dev.usbharu.hideout.application.config.CharacterLimit +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException import dev.usbharu.hideout.core.domain.model.actor.Actor import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.query.DeletedActorQueryService import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Test @@ -34,13 +36,19 @@ class ActorServiceTest { } val userService = UserServiceImpl( - actorRepository, - userAuthService, - mock(), - actorBuilder, - testApplicationConfig, - mock(), - mock() + actorRepository = actorRepository, + userAuthService = userAuthService, + actorQueryService = mock(), + actorBuilder = actorBuilder, + applicationConfig = testApplicationConfig, + instanceService = mock(), + userDetailRepository = mock(), + deletedActorRepository = mock(), + deletedActorQueryService = mock(), + reactionRepository = mock(), + relationshipRepository = mock(), + postService = mock(), + apSendDeleteService = mock() ) userService.createLocalUser(UserCreateDto("test", "testUser", "XXXXXXXXXXXXX", "test")) verify(actorRepository, times(1)).save(any()) @@ -65,8 +73,30 @@ class ActorServiceTest { val actorRepository = mock { onBlocking { nextId() } doReturn 113345L } + val deletedActorQueryService = mock { + onBlocking { + findByNameAndDomain( + eq("test"), + eq("remote.example.com") + ) + } doAnswer { throw FailedToGetResourcesException() } + } val userService = - UserServiceImpl(actorRepository, mock(), mock(), actorBuilder, testApplicationConfig, mock(), mock()) + UserServiceImpl( + actorRepository = actorRepository, + userAuthService = mock(), + actorQueryService = mock(), + actorBuilder = actorBuilder, + applicationConfig = testApplicationConfig, + instanceService = mock(), + userDetailRepository = mock(), + deletedActorRepository = mock(), + deletedActorQueryService = deletedActorQueryService, + reactionRepository = mock(), + relationshipRepository = mock(), + postService = mock(), + apSendDeleteService = mock() + ) val user = RemoteUserCreateDto( name = "test", domain = "remote.example.com",