-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from modu-menu/feat/update-food-type
기획 변경에 따른 음식점 카테고리 Enum 변경
- Loading branch information
Showing
5 changed files
with
88 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,47 @@ void findByUserIdReturnEmptyParticipant() { | |
assertThat(result).isEmpty(); | ||
} | ||
|
||
@DisplayName("userId, voteId를 통해 회원이 투표에 초대 받은 사람인지 확인한다.") | ||
@Test | ||
void findByUserIdAndVoteId() { | ||
// given | ||
User user1 = createUser("[email protected]"); | ||
User user2 = createUser("[email protected]"); | ||
Vote vote1 = createVote(VoteStatus.ACTIVE); | ||
Participant participant = createParticipant(user1, vote1, VoteRole.PARTICIPANT); | ||
userRepository.saveAll(List.of(user1, user2)); | ||
voteRepository.save(vote1); | ||
participantRepository.save(participant); | ||
|
||
// when | ||
Optional<Participant> result = participantRepository.findByUserIdAndVoteId(user1.getId(), vote1.getId()); | ||
|
||
// then | ||
assertThat(result) | ||
.isNotEmpty() | ||
.get() | ||
.hasFieldOrPropertyWithValue("id", 1L); | ||
} | ||
|
||
@DisplayName("초대 받지 않은 회원의 userId와 voteId를 통해 회원이 투표에 초대 받은 사람인지 확인한다.") | ||
@Test | ||
void findByUserIdAndVoteIdReturnEmptyParticipant() { | ||
// given | ||
User user1 = createUser("[email protected]"); | ||
User user2 = createUser("[email protected]"); | ||
Vote vote1 = createVote(VoteStatus.ACTIVE); | ||
Participant participant = createParticipant(user1, vote1, VoteRole.PARTICIPANT); | ||
userRepository.saveAll(List.of(user1, user2)); | ||
voteRepository.save(vote1); | ||
participantRepository.save(participant); | ||
|
||
// when | ||
Optional<Participant> result = participantRepository.findByUserIdAndVoteId(user2.getId(), vote1.getId()); | ||
|
||
// then | ||
assertThat(result).isEmpty(); | ||
} | ||
|
||
private User createUser(String email) { | ||
return User.builder() | ||
.email(email) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters