-
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.
Browse files
Browse the repository at this point in the history
[🆘 Bug] 아이디(username) 변경 시 한글, 특수문자 입력하면 오류 #182
- Loading branch information
Showing
4 changed files
with
45 additions
and
3 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
24 changes: 24 additions & 0 deletions
24
backend/application/api/src/test/kotlin/io/raemian/api/support/RegexTest.kt
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,24 @@ | ||
package io.raemian.api.support | ||
|
||
import org.junit.jupiter.api.DisplayName | ||
import org.junit.jupiter.api.Test | ||
|
||
class RegexTest { | ||
|
||
@Test | ||
@DisplayName("유저네임 영문+숫자+하이픈 으로만 생성 가능하도록 체크") | ||
fun validateUsername() { | ||
val regex = "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*".toRegex() | ||
val result1 = regex.matches("aaaaaa00000") | ||
val result2 = regex.matches("아아아아아아") | ||
val result3 = regex.matches("-aaaa") | ||
val result4 = regex.matches("aaaa-") | ||
val result5 = regex.matches("----") | ||
|
||
println(result1) | ||
println(result2) | ||
println(result3) | ||
println(result4) | ||
println(result5) | ||
} | ||
} |