Skip to content

Commit

Permalink
test: 다이어리 전체 조회 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
YongsHub committed Feb 25, 2024
1 parent 4bf50ef commit 0eabe6f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lovebird-api/src/main/resources/static/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4585,7 +4585,7 @@ <h4 id="_다이어리_삭제_response_fields"><a class="link" href="#_다이어
<div id="footer">
<div id="footer-text">
Version 1.0.2-SNAPSHOT<br>
Last updated 2024-02-06 12:23:01 +0900
Last updated 2024-02-12 13:10:39 +0900
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0eabe6f

Please sign in to comment.