feat(user): 사용자 자기정보 편집과 관리자 재설정 플로우를 연동
- lib/widgets/app_shell.dart에서 내 정보 다이얼로그를 추가하고 UserRepository.updateMe·비밀번호 변경 로직을 연결 - lib/features/masters/user/* 모듈에 phone·forcePasswordChange·passwordUpdatedAt 필드를 반영하고 reset-password/update-me API를 사용 - lib/core/validation/password_rules.dart을 신설해 비밀번호 정책 검증을 공통화하고 신규 위젯·테스트에서 재사용 - doc/stock_approval_system_api_v4.md 등 문서를 users 스펙 개편 내용으로 갱신하고 user_management_plan.md를 추가 - test/widgets/app_shell_test.dart 등에서 자기정보 수정·비밀번호 재설정 시나리오를 검증하고 기존 테스트를 보강
This commit is contained in:
57
test/core/validation/password_rules_test.dart
Normal file
57
test/core/validation/password_rules_test.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:superport_v2/core/validation/password_rules.dart';
|
||||
|
||||
void main() {
|
||||
group('PasswordRules', () {
|
||||
test('정책을 모두 만족하면 위반 목록이 비어 있다', () {
|
||||
const password = 'Aa1!abcd';
|
||||
|
||||
final result = PasswordRules.validate(password);
|
||||
|
||||
expect(result, isEmpty);
|
||||
expect(PasswordRules.isValid(password), isTrue);
|
||||
});
|
||||
|
||||
test('길이가 짧으면 tooShort 위반이 발생한다', () {
|
||||
final result = PasswordRules.validate('Aa1!');
|
||||
|
||||
expect(result, contains(PasswordRuleViolation.tooShort));
|
||||
expect(result, isNot(contains(PasswordRuleViolation.tooLong)));
|
||||
});
|
||||
|
||||
test('길이가 길면 tooLong 위반이 발생한다', () {
|
||||
const password =
|
||||
'Aa1!'
|
||||
'abcdefghijklmnopqrstu';
|
||||
|
||||
final result = PasswordRules.validate(password);
|
||||
|
||||
expect(result, contains(PasswordRuleViolation.tooLong));
|
||||
});
|
||||
|
||||
test('대문자가 없으면 missingUppercase 위반이 발생한다', () {
|
||||
final result = PasswordRules.validate('aa1!aaaa');
|
||||
|
||||
expect(result, contains(PasswordRuleViolation.missingUppercase));
|
||||
});
|
||||
|
||||
test('소문자가 없으면 missingLowercase 위반이 발생한다', () {
|
||||
final result = PasswordRules.validate('AA1!AAAA');
|
||||
|
||||
expect(result, contains(PasswordRuleViolation.missingLowercase));
|
||||
});
|
||||
|
||||
test('숫자가 없으면 missingDigit 위반이 발생한다', () {
|
||||
final result = PasswordRules.validate('AAa!aaaa');
|
||||
|
||||
expect(result, contains(PasswordRuleViolation.missingDigit));
|
||||
});
|
||||
|
||||
test('특수 문자가 없으면 missingSpecial 위반이 발생한다', () {
|
||||
final result = PasswordRules.validate('AAa1aaaa');
|
||||
|
||||
expect(result, contains(PasswordRuleViolation.missingSpecial));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user