-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from grida-diary/feature/diary
Feature/diary
- Loading branch information
Showing
2 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
grida-core/core-api/src/test/kotlin/org/grida/docs/diaryimage/DiaryImageApiDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.grida.docs.diaryimage | ||
|
||
import com.ninjasquad.springmockk.MockkBean | ||
import io.mockk.every | ||
import io.wwan13.api.document.snippets.NUMBER | ||
import io.wwan13.api.document.snippets.isTypeOf | ||
import io.wwan13.api.document.snippets.whichMeans | ||
import org.grida.docs.ApiDocsTest | ||
import org.grida.domain.diaryimage.DiaryImageService | ||
import org.grida.presentation.v1.diaryimage.DiaryImageController | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest | ||
|
||
@WebMvcTest(controllers = [DiaryImageController::class]) | ||
class DiaryImageApiDocsTest( | ||
private val diaryImageController: DiaryImageController | ||
) : ApiDocsTest( | ||
diaryImageController, | ||
"diary-image" | ||
) { | ||
|
||
@MockkBean | ||
private lateinit var diaryImageService: DiaryImageService | ||
|
||
@Test | ||
fun `일기 이미지 생성 API`() { | ||
every { diaryImageService.generateDiaryImage(any(), any()) } returns 1L | ||
|
||
val api = api.post("/api/v1/diary/{diaryId}/image", 1L) { | ||
withBearerToken() | ||
} | ||
|
||
documentFor(api, "generate-diary-image") { | ||
summary("일기 이미지 생성 API") | ||
requestHeaders( | ||
"Authorization" whichMeans "인증 토큰" | ||
) | ||
pathParameters( | ||
"diaryId" whichMeans "생성하려는 일기의 ID" | ||
) | ||
responseFields( | ||
"data.id" isTypeOf NUMBER whichMeans "생성된 일기 이미지 ID" | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters