change validation check name
This commit is contained in:
@@ -18,7 +18,7 @@ describe('handle validation', () => {
|
||||
})
|
||||
|
||||
const invalid = [
|
||||
['al', 'bsky.social', 'frontLengthLongEnough'],
|
||||
['al', 'bsky.social', 'frontLengthNotTooShort'],
|
||||
['-alice', 'bsky.social', 'hyphenStartOrEnd'],
|
||||
['alice-', 'bsky.social', 'hyphenStartOrEnd'],
|
||||
['%%%', 'bsky.social', 'handleChars'],
|
||||
@@ -28,7 +28,7 @@ describe('handle validation', () => {
|
||||
'my-custom-pds-with-long-name.social',
|
||||
'frontLengthNotTooLong',
|
||||
],
|
||||
['al', 'my-custom-pds-with-long-name.social', 'frontLengthLongEnough'],
|
||||
['al', 'my-custom-pds-with-long-name.social', 'frontLengthNotTooShort'],
|
||||
['a'.repeat(300), 'toolong.com', 'totalLength'],
|
||||
] satisfies [string, string, keyof IsValidHandle][]
|
||||
it.each(invalid)(
|
||||
|
||||
@@ -36,7 +36,7 @@ export function sanitizeHandle(handle: string, prefix = ''): string {
|
||||
export interface IsValidHandle {
|
||||
handleChars: boolean
|
||||
hyphenStartOrEnd: boolean
|
||||
frontLengthLongEnough: boolean
|
||||
frontLengthNotTooShort: boolean
|
||||
frontLengthNotTooLong: boolean
|
||||
totalLength: boolean
|
||||
overall: boolean
|
||||
@@ -53,7 +53,7 @@ export function validateServiceHandle(
|
||||
handleChars:
|
||||
!str || (VALIDATE_REGEX.test(fullHandle) && !str.includes('.')),
|
||||
hyphenStartOrEnd: !str.startsWith('-') && !str.endsWith('-'),
|
||||
frontLengthLongEnough: str.length >= 3,
|
||||
frontLengthNotTooShort: str.length >= 3,
|
||||
frontLengthNotTooLong: str.length <= MAX_SERVICE_HANDLE_LENGTH,
|
||||
totalLength: fullHandle.length <= 253,
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ export function StepHandle() {
|
||||
<RequirementIcon
|
||||
state={
|
||||
validCheck.handleChars && validCheck.hyphenStartOrEnd
|
||||
? !validCheck.frontLengthLongEnough
|
||||
? !validCheck.frontLengthNotTooShort
|
||||
? 'initial'
|
||||
: 'valid'
|
||||
: 'invalid'
|
||||
@@ -220,7 +220,7 @@ export function StepHandle() {
|
||||
<Requirement>
|
||||
<RequirementIcon
|
||||
state={
|
||||
!validCheck.frontLengthLongEnough
|
||||
!validCheck.frontLengthNotTooShort
|
||||
? 'initial'
|
||||
: validCheck.frontLengthNotTooLong && validCheck.totalLength
|
||||
? 'valid'
|
||||
|
||||
Reference in New Issue
Block a user