Skip to content

Commit

Permalink
test: 변수명 수정 (member -> author)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanueleee committed Oct 17, 2023
1 parent 9b4e4ec commit 30457d2
Showing 1 changed file with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ class 리뷰_삭제_이벤트_발행 {
@Test
void 리뷰_작성자가_리뷰_삭제_시도시_리뷰_삭제_이벤트가_발행된다() {
// given
final var member = 멤버_멤버1_생성();
단일_멤버_저장(member);
final var author = 멤버_멤버1_생성();
final var authorId = 단일_멤버_저장(author);

final var category = 카테고리_즉석조리_생성();
단일_카테고리_저장(category);

final var product = 상품_삼각김밥_가격1000원_평점2점_생성(category);
단일_상품_저장(product);

final var review = reviewRepository.save(리뷰_이미지test1_평점1점_재구매O_생성(member, product, 0L));
final var review = reviewRepository.save(리뷰_이미지test1_평점1점_재구매O_생성(author, product, 0L));

// when
reviewService.deleteReview(review.getId(), member.getId());
reviewService.deleteReview(review.getId(), authorId);

// then
final var count = events.stream(ReviewDeleteEvent.class).count();
Expand All @@ -57,11 +57,11 @@ class 리뷰_삭제_이벤트_발행 {
@Test
void 리뷰_작성자가_아닌_사람이_리뷰_삭제_시도시_리뷰_삭제_이벤트가_발행되지_않는다() {
// given
final var member = 멤버_멤버1_생성();
단일_멤버_저장(member);
final var author = 멤버_멤버1_생성();
final var authorId = 단일_멤버_저장(author);

final var author = 멤버_멤버2_생성();
단일_멤버_저장(author);
final var member = 멤버_멤버2_생성();
final var memberId = 단일_멤버_저장(member);

final var category = 카테고리_즉석조리_생성();
단일_카테고리_저장(category);
Expand All @@ -73,7 +73,7 @@ class 리뷰_삭제_이벤트_발행 {

// when
try {
reviewService.deleteReview(review.getId(), member.getId());
reviewService.deleteReview(review.getId(), memberId);
} catch (Exception ignored) {
}

Expand All @@ -89,19 +89,19 @@ class 이미지_삭제_로직_작동 {
@Test
void 리뷰_삭제가_정상적으로_커밋되고_이미지가_존재하면_이미지_삭제_로직이_작동한다() {
// given
final var member = 멤버_멤버1_생성();
단일_멤버_저장(member);
final var author = 멤버_멤버1_생성();
final var authorId = 단일_멤버_저장(author);

final var category = 카테고리_즉석조리_생성();
단일_카테고리_저장(category);

final var product = 상품_삼각김밥_가격1000원_평점2점_생성(category);
단일_상품_저장(product);

final var review = reviewRepository.save(리뷰_이미지test3_평점3점_재구매O_생성(member, product, 0L));
final var review = reviewRepository.save(리뷰_이미지test3_평점3점_재구매O_생성(author, product, 0L));

// when
reviewService.deleteReview(review.getId(), member.getId());
reviewService.deleteReview(review.getId(), authorId);

// then
verify(uploader, timeout(1000).times(1)).delete(any());
Expand All @@ -110,19 +110,19 @@ class 이미지_삭제_로직_작동 {
@Test
void 리뷰_삭제가_정상적으로_커밋되었지만_이미지가_존재하지_않으면_이미지_삭제_로직이_작동하지않는다() {
// given
final var member = 멤버_멤버1_생성();
단일_멤버_저장(member);
final var author = 멤버_멤버1_생성();
final var authorId = 단일_멤버_저장(author);

final var category = 카테고리_즉석조리_생성();
단일_카테고리_저장(category);

final var product = 상품_삼각김밥_가격1000원_평점2점_생성(category);
단일_상품_저장(product);

final var review = reviewRepository.save(리뷰_이미지없음_평점1점_재구매X_생성(member, product, 0L));
final var review = reviewRepository.save(리뷰_이미지없음_평점1점_재구매X_생성(author, product, 0L));

// when
reviewService.deleteReview(review.getId(), member.getId());
reviewService.deleteReview(review.getId(), authorId);

// then
verify(uploader, timeout(1000).times(0)).delete(any());
Expand All @@ -131,23 +131,23 @@ class 이미지_삭제_로직_작동 {
@Test
void 이미지_삭제_로직이_실패해도_메인로직까지_롤백되어서는_안된다() {
// given
final var member = 멤버_멤버1_생성();
단일_멤버_저장(member);
final var author = 멤버_멤버1_생성();
final var authorId = 단일_멤버_저장(author);

final var category = 카테고리_즉석조리_생성();
단일_카테고리_저장(category);

final var product = 상품_삼각김밥_가격1000원_평점2점_생성(category);
단일_상품_저장(product);

final var review = reviewRepository.save(리뷰_이미지test4_평점4점_재구매O_생성(member, product, 0L));
final var review = reviewRepository.save(리뷰_이미지test4_평점4점_재구매O_생성(author, product, 0L));

doThrow(new S3DeleteFailException(CommonErrorCode.UNKNOWN_SERVER_ERROR_CODE))
.when(uploader)
.delete(any());

// when
reviewService.deleteReview(review.getId(), member.getId());
reviewService.deleteReview(review.getId(), authorId);

// then
assertThat(reviewRepository.findById(review.getId())).isEmpty();
Expand Down

0 comments on commit 30457d2

Please sign in to comment.