mirror of https://github.com/usbharu/Hideout.git
test: テストを修正
This commit is contained in:
parent
9f05e296a6
commit
0f51ea7a17
|
@ -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
|
||||
|
||||
|
|
|
@ -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<ActorRepository> {
|
||||
onBlocking { nextId() } doReturn 113345L
|
||||
}
|
||||
val deletedActorQueryService = mock<DeletedActorQueryService> {
|
||||
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",
|
||||
|
|
Loading…
Reference in New Issue