From 0eabe6fff6cd7c6b515a64da1040caf6d4a7dc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=9A=A9?= Date: Sun, 25 Feb 2024 18:37:46 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EB=8B=A4=EC=9D=B4=EC=96=B4=EB=A6=AC=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/docs/index.html | 2 +- .../controller/diary/DiaryControllerTest.kt | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lovebird-api/src/main/resources/static/docs/index.html b/lovebird-api/src/main/resources/static/docs/index.html index fc1bc65..a383425 100644 --- a/lovebird-api/src/main/resources/static/docs/index.html +++ b/lovebird-api/src/main/resources/static/docs/index.html @@ -4585,7 +4585,7 @@

diff --git a/lovebird-api/src/test/kotlin/com/lovebird/api/controller/diary/DiaryControllerTest.kt b/lovebird-api/src/test/kotlin/com/lovebird/api/controller/diary/DiaryControllerTest.kt index af60737..dd63930 100644 --- a/lovebird-api/src/test/kotlin/com/lovebird/api/controller/diary/DiaryControllerTest.kt +++ b/lovebird-api/src/test/kotlin/com/lovebird/api/controller/diary/DiaryControllerTest.kt @@ -124,6 +124,37 @@ class DiaryControllerTest( } } + describe("GET : /api/v1/diaries") { + val user = CommonTestFixture.getUser(1L, "uniqueProviderId") + val url = "$baseUrl" + + context("다이어리 전체 조회 요청한다면") { + val request = request(HttpMethod.GET, url) + .header(HttpHeaders.AUTHORIZATION, "Bearer access-token") + val diaries = DiaryTestFixture.getDiarySimpleResponseList(user, null, 5) + val response = DiarySimpleListResponse.of(diaries) + + it("1000 SUCCESS") { + every { diaryService.findAll(any()) } returns response + + mockMvc + .perform(request) + .andExpect(status().isOk) + .andDocument( + "1000-diary-list-all", + requestHeaders( + "Authorization" headerMeans "액세스 토큰" + ), + envelopeResponseBody( + "data.diaries" type ARRAY means "다이어리 목록", + "data.totalCount" type NUMBER means "캘린더 개수" + ) + .andWithPrefix("data.diaries[].", getSimpleDiaryDetailResponseSnippet()) + ) + } + } + } + describe("GET : /api/v1/diaries/{diaryId}") { val user = CommonTestFixture.getUser(1L, "uniqueProviderId") val diary = DiaryTestFixture.getDiaryByUser(user)