feat(dashboard): 결재 역할 뱃지와 문서 정합성 반영
- doc/frontend_backend_alignment_report.md에 roles 필터 적용 배경과 UI 반영 사항을 기록 - lib/features/dashboard/data/dashboard_summary_dto.dart에서 roles 파싱과 enum 매핑 로직, 문자열 리스트 util 추가 - lib/features/dashboard/domain/entities/dashboard_pending_approval.dart에 역할 enum과 도메인 필드 추가 - lib/features/dashboard/presentation/pages/dashboard_page.dart에서 결재 카드 헤더/설명 수정 및 역할 뱃지 렌더링 지원 - test/features/dashboard/data/dashboard_summary_dto_test.dart 신규 작성해 DTO→도메인 매핑과 무시 케이스를 검증 - test/features/masters/user/presentation/pages/user_page_test.dart에서 사용되지 않는 PermissionManager import 제거
This commit is contained in:
59
test/features/dashboard/data/dashboard_summary_dto_test.dart
Normal file
59
test/features/dashboard/data/dashboard_summary_dto_test.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:superport_v2/features/dashboard/data/dtos/dashboard_summary_dto.dart';
|
||||
import 'package:superport_v2/features/dashboard/domain/entities/dashboard_pending_approval.dart';
|
||||
|
||||
void main() {
|
||||
group('DashboardSummaryDto', () {
|
||||
test('maps pending approval roles into domain entities', () {
|
||||
final dto = DashboardSummaryDto.fromJson({
|
||||
'generated_at': '2025-01-01T00:00:00Z',
|
||||
'kpis': [],
|
||||
'recent_transactions': [],
|
||||
'pending_approvals': [
|
||||
{
|
||||
'approval_id': 1,
|
||||
'approval_no': 'APP-001',
|
||||
'title': '입고 결재',
|
||||
'step_summary': '1단계 → 2단계',
|
||||
'requested_at': '2025-01-01T03:00:00Z',
|
||||
'roles': ['assigned', 'requested', 'completed'],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
final entity = dto.toEntity();
|
||||
final approval = entity.pendingApprovals.single;
|
||||
|
||||
expect(
|
||||
approval.roles,
|
||||
containsAll(<DashboardApprovalRole>[
|
||||
DashboardApprovalRole.assigned,
|
||||
DashboardApprovalRole.requester,
|
||||
DashboardApprovalRole.completed,
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test('ignores unknown role tokens gracefully', () {
|
||||
final dto = DashboardSummaryDto.fromJson({
|
||||
'generated_at': '2025-01-01T00:00:00Z',
|
||||
'kpis': [],
|
||||
'recent_transactions': [],
|
||||
'pending_approvals': [
|
||||
{
|
||||
'approval_id': 2,
|
||||
'approval_no': 'APP-002',
|
||||
'title': '출고 결재',
|
||||
'step_summary': '3단계',
|
||||
'requested_at': '2025-01-02T03:00:00Z',
|
||||
'roles': ['REQUESTER', 'unknown', ''],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
final approval = dto.toEntity().pendingApprovals.single;
|
||||
|
||||
expect(approval.roles, [DashboardApprovalRole.requester]);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user