@@ -35,8 +35,6 @@ import {
3535 fixProfaneUsername ,
3636 isProfaneUsername ,
3737 MAX_USERNAME_LENGTH ,
38- MIN_USERNAME_LENGTH ,
39- sanitizeUsername ,
4038 validateUsername ,
4139} from "../src/core/validations/username" ;
4240
@@ -105,30 +103,9 @@ describe("username.ts functions", () => {
105103 const res = validateUsername ( "Good_Name123" ) ;
106104 expect ( res . isValid ) . toBe ( true ) ;
107105 } ) ;
108- test ( "accepts allowed Unicode like 🐈 or ü" , ( ) => {
109- const res = validateUsername ( "Cat🐈 Üser" ) ;
106+ test ( "accepts allowed Unicode like ü" , ( ) => {
107+ const res = validateUsername ( "Üser" ) ;
110108 expect ( res . isValid ) . toBe ( true ) ;
111109 } ) ;
112110 } ) ;
113-
114- describe ( "sanitizeUsername" , ( ) => {
115- test . each ( [
116- { input : "GoodName" , expected : "GoodName" } ,
117- { input : "a!" , expected : "axx" } ,
118- { input : "a$%b" , expected : "abx" } ,
119- {
120- input : "abc" . repeat ( 10 ) ,
121- expected : "abc"
122- . repeat ( Math . floor ( MAX_USERNAME_LENGTH / 3 ) )
123- . slice ( 0 , MAX_USERNAME_LENGTH ) ,
124- } ,
125- { input : "" , expected : "xxx" } ,
126- { input : "Ünicode🐈Test!" , expected : "Ünicode🐈Test" } ,
127- ] ) ( 'sanitizeUsername("%s") → "%s"' , ( { input, expected } ) => {
128- const out = sanitizeUsername ( input ) ;
129- expect ( out ) . toBe ( expected ) ;
130- expect ( out . length ) . toBeGreaterThanOrEqual ( MIN_USERNAME_LENGTH ) ;
131- expect ( out . length ) . toBeLessThanOrEqual ( MAX_USERNAME_LENGTH ) ;
132- } ) ;
133- } ) ;
134111} ) ;
0 commit comments