Production hardening: password complexity, token refresh, network resilience
Password complexity: real-time validation UI on register, onboarding, and reset screens (uppercase, lowercase, digit, min 8 chars) — Compose + iOS Swift iOS privacy descriptions: camera, photo library, photo save usage strings Token refresh: Ktor interceptor catches 401 "token_expired", refreshes, retries Retry with backoff: 3 retries on 5xx/IO errors, exponential delay (1s base, 10s max) Gzip: ContentEncoding plugin on all platform HTTP clients Request timeouts: 30s request, 10s connect, 30s socket Validation rules: split passwordMissingLetter into uppercase/lowercase (iOS Swift) Test fixes: corrected import paths in 5 existing test files New tests: HTTP client retry/refresh (9), validation rules
This commit is contained in:
@@ -37,6 +37,16 @@ struct ValidationErrorTests {
|
||||
#expect(error.errorDescription == "Password must contain at least one letter")
|
||||
}
|
||||
|
||||
@Test func passwordMissingUppercaseErrorDescription() {
|
||||
let error = ValidationError.passwordMissingUppercase
|
||||
#expect(error.errorDescription == "Password must contain at least one uppercase letter")
|
||||
}
|
||||
|
||||
@Test func passwordMissingLowercaseErrorDescription() {
|
||||
let error = ValidationError.passwordMissingLowercase
|
||||
#expect(error.errorDescription == "Password must contain at least one lowercase letter")
|
||||
}
|
||||
|
||||
@Test func passwordMissingNumberErrorDescription() {
|
||||
let error = ValidationError.passwordMissingNumber
|
||||
#expect(error.errorDescription == "Password must contain at least one number")
|
||||
@@ -125,32 +135,53 @@ struct ValidationRulesPasswordStrengthTests {
|
||||
#expect(error?.errorDescription == "Password is required")
|
||||
}
|
||||
|
||||
@Test func noLetterReturnsMissingLetter() {
|
||||
let error = ValidationRules.validatePasswordStrength("123456")
|
||||
#expect(error?.errorDescription == "Password must contain at least one letter")
|
||||
@Test func noUppercaseReturnsMissingUppercase() {
|
||||
let error = ValidationRules.validatePasswordStrength("abc123")
|
||||
#expect(error?.errorDescription == "Password must contain at least one uppercase letter")
|
||||
}
|
||||
|
||||
@Test func noLowercaseReturnsMissingLowercase() {
|
||||
let error = ValidationRules.validatePasswordStrength("ABC123")
|
||||
#expect(error?.errorDescription == "Password must contain at least one lowercase letter")
|
||||
}
|
||||
|
||||
@Test func noNumberReturnsMissingNumber() {
|
||||
let error = ValidationRules.validatePasswordStrength("abcdef")
|
||||
let error = ValidationRules.validatePasswordStrength("Abcdef")
|
||||
#expect(error?.errorDescription == "Password must contain at least one number")
|
||||
}
|
||||
|
||||
@Test func letterAndNumberReturnsNil() {
|
||||
let error = ValidationRules.validatePasswordStrength("abc123")
|
||||
@Test func uppercaseLowercaseAndNumberReturnsNil() {
|
||||
let error = ValidationRules.validatePasswordStrength("Abc123")
|
||||
#expect(error == nil)
|
||||
}
|
||||
|
||||
@Test func isValidPasswordReturnsTrueForStrong() {
|
||||
#expect(ValidationRules.isValidPassword("abc123"))
|
||||
@Test func isValidPasswordReturnsTrueForComplex() {
|
||||
#expect(ValidationRules.isValidPassword("Abc123"))
|
||||
}
|
||||
|
||||
@Test func isValidPasswordReturnsFalseForLettersOnly() {
|
||||
@Test func isValidPasswordReturnsFalseForLowercaseOnly() {
|
||||
#expect(!ValidationRules.isValidPassword("abcdef"))
|
||||
}
|
||||
|
||||
@Test func isValidPasswordReturnsFalseForUppercaseOnly() {
|
||||
#expect(!ValidationRules.isValidPassword("ABCDEF"))
|
||||
}
|
||||
|
||||
@Test func isValidPasswordReturnsFalseForNumbersOnly() {
|
||||
#expect(!ValidationRules.isValidPassword("123456"))
|
||||
}
|
||||
|
||||
@Test func isValidPasswordReturnsFalseForNoUppercase() {
|
||||
#expect(!ValidationRules.isValidPassword("abc123"))
|
||||
}
|
||||
|
||||
@Test func isValidPasswordReturnsFalseForNoLowercase() {
|
||||
#expect(!ValidationRules.isValidPassword("ABC123"))
|
||||
}
|
||||
|
||||
@Test func isValidPasswordReturnsFalseForNoDigit() {
|
||||
#expect(!ValidationRules.isValidPassword("Abcdef"))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Password Match Tests
|
||||
|
||||
Reference in New Issue
Block a user