-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#101 [feat] 전화번호 인증 api 구현
- Loading branch information
Showing
8 changed files
with
109 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
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
4 changes: 4 additions & 0 deletions
4
src/main/java/com/moddy/server/controller/auth/dto/request/VerifyCodeRequestDto.java
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.moddy.server.controller.auth.dto.request; | ||
|
||
public record VerifyCodeRequestDto(String phoneNumber, String verifyCode) { | ||
} |
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
45 changes: 45 additions & 0 deletions
45
src/test/java/com/moddy/server/domain/verify/UserVerificationTest.java
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.moddy.server.domain.verify; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
|
||
class UserVerificationTest { | ||
|
||
@Test | ||
@DisplayName("테이블 생성 시간이 2000년 2월 3일 6시 30분이고, 이후에 3분이 지났으면 true를 반환한다.") | ||
void isExpireCodeTest() { | ||
// given | ||
UserVerification userVerification = UserVerification | ||
.builder() | ||
.createdAt(LocalDateTime.of(2000, 2, 3, 6, 30)) | ||
.build(); | ||
LocalDateTime now = LocalDateTime.of(2000, 2, 3, 6, 33); | ||
|
||
// when | ||
boolean isExpire = userVerification.isExpireCode(now); | ||
|
||
// then | ||
assertThat(isExpire).isTrue(); | ||
} | ||
|
||
@Test | ||
@DisplayName("테이블 생성 시간이 2000년 2월 3일 6시 30분이고, 이후에 2분이 지났으면 false를 반환한다.") | ||
void isExpireCodeTest2() { | ||
// given | ||
UserVerification userVerification = UserVerification | ||
.builder() | ||
.createdAt(LocalDateTime.of(2000, 2, 3, 6, 30)) | ||
.build(); | ||
LocalDateTime now = LocalDateTime.of(2000, 2, 3, 6, 32); | ||
|
||
// when | ||
boolean isExpire = userVerification.isExpireCode(now); | ||
|
||
// then | ||
assertThat(isExpire).isFalse(); | ||
} | ||
} |