Skip to content

Commit

Permalink
test: postservice find all badge test (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
birdieHyun committed Jun 18, 2023
1 parent ac56282 commit 63fb0bb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions be/src/test/java/com/secondhand/post/PostServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;

@SpringBootTest
class PostServiceTest {
Expand Down Expand Up @@ -83,6 +84,26 @@ void updateBadgeTest() {
assertThat(postMeta.getBadge().getId()).isEqualTo(2);
}

@Transactional(readOnly = true)
@Test
@DisplayName("사용자는 상품 상태 업데이트를 위해 모든 배지를 조회할 수 있다.")
void findAllBadgesTest() {
// given

// when
List<Badge> badges = postService.findBadges().getBadges();

// then
assertThat(badges).hasSize(4)
.extracting("id", "state", "backgroundColor", "fontColor")
.containsExactlyInAnyOrder(
tuple(1, "판매 중", null, null),
tuple(2, "예약 중", "#abab12", "#ff0000"),
tuple(3, "판매 완료", "#00ff00", "#ff00ff"),
tuple(4, "광고", "#000000", "#00ffff")
);
}

private PostMeta createPostMeta() {

UserProfileResponse userProfileResponse = new UserProfileResponse();
Expand Down

0 comments on commit 63fb0bb

Please sign in to comment.