|
17 | 17 | import eatda.controller.store.StoreResponse; |
18 | 18 | import eatda.controller.store.StoresInMemberResponse; |
19 | 19 | import eatda.controller.store.StoresResponse; |
| 20 | +import eatda.controller.store.TagsResponse; |
20 | 21 | import eatda.document.BaseDocumentTest; |
21 | 22 | import eatda.document.RestDocsRequest; |
22 | 23 | import eatda.document.RestDocsResponse; |
23 | 24 | import eatda.document.Tag; |
| 25 | +import eatda.domain.cheer.CheerTagName; |
24 | 26 | import eatda.domain.store.District; |
25 | 27 | import eatda.domain.store.StoreCategory; |
26 | 28 | import eatda.domain.store.StoreSearchResult; |
@@ -228,6 +230,57 @@ class GetStoreImages { |
228 | 230 |
|
229 | 231 | } |
230 | 232 |
|
| 233 | + @Nested |
| 234 | + class GetStoreTags { |
| 235 | + |
| 236 | + RestDocsRequest requestDocument = request() |
| 237 | + .tag(Tag.STORE_API) |
| 238 | + .summary("음식점 태그 조회") |
| 239 | + .pathParameter( |
| 240 | + parameterWithName("storeId").description("음식점 ID") |
| 241 | + ); |
| 242 | + |
| 243 | + RestDocsResponse responseDocument = response() |
| 244 | + .responseBodyField( |
| 245 | + fieldWithPath("tags").type(ARRAY).description("음식점 태그 목록") |
| 246 | + ); |
| 247 | + |
| 248 | + @Test |
| 249 | + void 음식점_태그_조회_성공() { |
| 250 | + long storeId = 7L; |
| 251 | + TagsResponse response = new TagsResponse(List.of(CheerTagName.INSTAGRAMMABLE, CheerTagName.CLEAN_RESTROOM)); |
| 252 | + doReturn(response).when(storeService).getStoreTags(storeId); |
| 253 | + |
| 254 | + var document = document("store/get-tags", 200) |
| 255 | + .request(requestDocument) |
| 256 | + .response(responseDocument) |
| 257 | + .build(); |
| 258 | + |
| 259 | + given(document) |
| 260 | + .contentType(ContentType.JSON) |
| 261 | + .when().get("/api/shops/{storeId}/tags", storeId) |
| 262 | + .then().statusCode(200); |
| 263 | + } |
| 264 | + |
| 265 | + @EnumSource(value = BusinessErrorCode.class, names = {"STORE_NOT_FOUND"}) |
| 266 | + @ParameterizedTest |
| 267 | + void 음식점_태그_조회_실패(BusinessErrorCode errorCode) { |
| 268 | + long storeId = 1L; |
| 269 | + doThrow(new BusinessException(errorCode)).when(storeService).getStoreTags(storeId); |
| 270 | + |
| 271 | + var document = document("store/get-tags", errorCode) |
| 272 | + .request(requestDocument) |
| 273 | + .response(ERROR_RESPONSE) |
| 274 | + .build(); |
| 275 | + |
| 276 | + given(document) |
| 277 | + .contentType(ContentType.JSON) |
| 278 | + .pathParam("storeId", storeId) |
| 279 | + .when().get("/api/shops/{storeId}/tags") |
| 280 | + .then().statusCode(errorCode.getStatus().value()); |
| 281 | + } |
| 282 | + } |
| 283 | + |
231 | 284 | @Nested |
232 | 285 | class GetStoresByCheeredMember { |
233 | 286 |
|
|
0 commit comments