mirror of https://github.com/usbharu/Hideout.git
test: テストを修正
This commit is contained in:
parent
3b188f3033
commit
4d60a7eeb8
|
@ -4,7 +4,6 @@ import com.auth0.jwt.interfaces.Claim
|
||||||
import com.auth0.jwt.interfaces.Payload
|
import com.auth0.jwt.interfaces.Payload
|
||||||
import com.fasterxml.jackson.module.kotlin.readValue
|
import com.fasterxml.jackson.module.kotlin.readValue
|
||||||
import dev.usbharu.hideout.config.Config
|
import dev.usbharu.hideout.config.Config
|
||||||
import dev.usbharu.hideout.domain.model.hideout.dto.PostCreateDto
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Post
|
import dev.usbharu.hideout.domain.model.hideout.entity.Post
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Visibility
|
import dev.usbharu.hideout.domain.model.hideout.entity.Visibility
|
||||||
import dev.usbharu.hideout.plugins.TOKEN_AUTH
|
import dev.usbharu.hideout.plugins.TOKEN_AUTH
|
||||||
|
@ -240,11 +239,12 @@ class PostsTest {
|
||||||
on { getClaim(eq("uid")) } doReturn claim
|
on { getClaim(eq("uid")) } doReturn claim
|
||||||
}
|
}
|
||||||
val postService = mock<IPostApiService> {
|
val postService = mock<IPostApiService> {
|
||||||
onBlocking { createPost(any<PostCreateDto>()) } doAnswer {
|
onBlocking { createPost(any(), any()) } doAnswer {
|
||||||
val argument = it.getArgument<PostCreateDto>(0)
|
val argument = it.getArgument<dev.usbharu.hideout.domain.model.hideout.form.Post>(0)
|
||||||
|
val userId = it.getArgument<Long>(1)
|
||||||
Post(
|
Post(
|
||||||
123L,
|
123L,
|
||||||
argument.userId,
|
userId,
|
||||||
null,
|
null,
|
||||||
argument.text,
|
argument.text,
|
||||||
Instant.now().toEpochMilli(),
|
Instant.now().toEpochMilli(),
|
||||||
|
@ -279,9 +279,9 @@ class PostsTest {
|
||||||
assertEquals(HttpStatusCode.OK, status)
|
assertEquals(HttpStatusCode.OK, status)
|
||||||
assertEquals("https://example.com", headers["Location"])
|
assertEquals("https://example.com", headers["Location"])
|
||||||
}
|
}
|
||||||
argumentCaptor<PostCreateDto> {
|
argumentCaptor<dev.usbharu.hideout.domain.model.hideout.form.Post> {
|
||||||
verify(postService).createPost(capture())
|
verify(postService).createPost(capture(), any())
|
||||||
assertEquals(PostCreateDto("test", userId = 1234), firstValue)
|
assertEquals(dev.usbharu.hideout.domain.model.hideout.form.Post("test"), firstValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue