-
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.
- Loading branch information
1 parent
f0036fa
commit e022c91
Showing
1 changed file
with
38 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import static org.assertj.core.api.Assertions.*; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
@@ -30,10 +31,45 @@ void setUp() { | |
@Test | ||
void 회원가입을_한다() { | ||
// given & when | ||
userService.join("[email protected]", OAuthProvider.EATSSU, "1234"); | ||
회원가입_요청(); | ||
|
||
// then | ||
assertThat(userRepository.findAll()).hasSize(1); | ||
} | ||
|
||
} | ||
@Test | ||
void 닉네임을_변경한다() { | ||
// given | ||
User user = 회원가입_요청(); | ||
CustomUserDetails userDetails = UserDetails_생성(user); | ||
|
||
// when | ||
userService.updateNickname(userDetails, new NicknameUpdateRequest("newNickname")); | ||
|
||
// then | ||
user = userRepository.findById(userDetails.getId()).orElseThrow(); | ||
assertThat(user.getNickname()).isEqualTo("newNickname"); | ||
} | ||
|
||
@Test | ||
void 회원탈퇴를_한다() { | ||
// given | ||
User user = 회원가입_요청(); | ||
CustomUserDetails userDetails = UserDetails_생성(user); | ||
|
||
// when | ||
userService.withdraw(userDetails); | ||
|
||
// then | ||
assertThat(userRepository.findAll()).hasSize(0); | ||
} | ||
|
||
private User 회원가입_요청() { | ||
return userService.join("[email protected]", OAuthProvider.EATSSU, "1234"); | ||
} | ||
|
||
@NotNull | ||
private CustomUserDetails UserDetails_생성(User user) { | ||
return new CustomUserDetails(user); | ||
} | ||
} |