diff --git a/src/test/kotlin/dev/usbharu/hideout/routing/api/internal/v1/PostsTest.kt b/src/test/kotlin/dev/usbharu/hideout/routing/api/internal/v1/PostsTest.kt index 50b54ded..d4777c46 100644 --- a/src/test/kotlin/dev/usbharu/hideout/routing/api/internal/v1/PostsTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/routing/api/internal/v1/PostsTest.kt @@ -4,7 +4,6 @@ import com.auth0.jwt.interfaces.Claim import com.auth0.jwt.interfaces.Payload import com.fasterxml.jackson.module.kotlin.readValue 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.Visibility import dev.usbharu.hideout.plugins.TOKEN_AUTH @@ -240,11 +239,12 @@ class PostsTest { on { getClaim(eq("uid")) } doReturn claim } val postService = mock { - onBlocking { createPost(any()) } doAnswer { - val argument = it.getArgument(0) + onBlocking { createPost(any(), any()) } doAnswer { + val argument = it.getArgument(0) + val userId = it.getArgument(1) Post( 123L, - argument.userId, + userId, null, argument.text, Instant.now().toEpochMilli(), @@ -279,9 +279,9 @@ class PostsTest { assertEquals(HttpStatusCode.OK, status) assertEquals("https://example.com", headers["Location"]) } - argumentCaptor { - verify(postService).createPost(capture()) - assertEquals(PostCreateDto("test", userId = 1234), firstValue) + argumentCaptor { + verify(postService).createPost(capture(), any()) + assertEquals(dev.usbharu.hideout.domain.model.hideout.form.Post("test"), firstValue) } }