feat(approvals): Approval Flow v2 프런트엔드 전면 개편
- 환경/라우터 모듈에 approval_flow_v2 토글을 추가하고 FeatureFlags 초기화를 연결 (.env*, lib/core/**) - ApiClient 빌더·ApiRoutes 확장과 ApprovalRepositoryRemote 리팩터링으로 include·액션 시그니처를 정합화 - ApprovalFlow·ApprovalDraft 엔티티/레포/유즈케이스를 도입해 서버 초안과 단계 액션(승인·회수·재상신)을 지원 - Approval 컨트롤러·히스토리·템플릿 페이지와 공유 위젯을 재작성해 감사 로그·회수 UX·템플릿 CRUD를 반영 - Inbound/Outbound/Rental 컨트롤러·페이지에 결재 섹션을 삽입하고 대시보드 pending 카드 요약을 갱신 - SuperportDialog·FormField 등 공통 위젯을 보강하고 승인 위젯 가이드를 추가해 UI 가이드를 정리 - 결재/재고 테스트 픽스처와 단위·위젯·통합 테스트를 확장하고 flutter_test_config로 스테이징 호스트를 허용 - Approval Flow 레포트/플랜 문서를 업데이트하고 ApprovalFlow_System_Integration_and_ChangePlan.md를 추가 - 실행: flutter analyze, flutter test
This commit is contained in:
@@ -7,12 +7,17 @@ import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import 'package:superport_v2/core/common/models/paginated_result.dart';
|
||||
import 'package:superport_v2/features/approvals/domain/entities/approval_template.dart';
|
||||
import 'package:superport_v2/features/approvals/domain/repositories/approval_repository.dart';
|
||||
import 'package:superport_v2/features/approvals/domain/repositories/approval_template_repository.dart';
|
||||
import 'package:superport_v2/features/approvals/domain/usecases/apply_approval_template_use_case.dart';
|
||||
import 'package:superport_v2/features/approvals/domain/usecases/save_approval_template_use_case.dart';
|
||||
import 'package:superport_v2/features/approvals/template/presentation/pages/approval_template_page.dart';
|
||||
|
||||
class _MockApprovalTemplateRepository extends Mock
|
||||
implements ApprovalTemplateRepository {}
|
||||
|
||||
class _MockApprovalRepository extends Mock implements ApprovalRepository {}
|
||||
|
||||
class _FakeTemplateInput extends Fake implements ApprovalTemplateInput {}
|
||||
|
||||
class _FakeTemplateStepInput extends Fake
|
||||
@@ -56,13 +61,27 @@ void main() {
|
||||
|
||||
group('플래그 On', () {
|
||||
late _MockApprovalTemplateRepository repository;
|
||||
late _MockApprovalRepository approvalRepository;
|
||||
|
||||
setUp(() {
|
||||
dotenv.testLoad(fileInput: 'FEATURE_APPROVALS_ENABLED=true\n');
|
||||
repository = _MockApprovalTemplateRepository();
|
||||
approvalRepository = _MockApprovalRepository();
|
||||
GetIt.I.registerLazySingleton<ApprovalTemplateRepository>(
|
||||
() => repository,
|
||||
);
|
||||
GetIt.I.registerLazySingleton<ApprovalRepository>(
|
||||
() => approvalRepository,
|
||||
);
|
||||
GetIt.I.registerLazySingleton<SaveApprovalTemplateUseCase>(
|
||||
() => SaveApprovalTemplateUseCase(repository: repository),
|
||||
);
|
||||
GetIt.I.registerLazySingleton<ApplyApprovalTemplateUseCase>(
|
||||
() => ApplyApprovalTemplateUseCase(
|
||||
templateRepository: repository,
|
||||
approvalRepository: approvalRepository,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
ApprovalTemplate buildTemplate({bool isActive = true}) {
|
||||
@@ -114,6 +133,7 @@ void main() {
|
||||
|
||||
expect(find.text('AP_INBOUND'), findsOneWidget);
|
||||
expect(find.text('입고 템플릿'), findsOneWidget);
|
||||
expect(find.textContaining('1. 최승인'), findsOneWidget);
|
||||
|
||||
verify(
|
||||
() =>
|
||||
@@ -188,6 +208,54 @@ void main() {
|
||||
expect(find.text('템플릿 "신규 템플릿"을 생성했습니다.'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('보기 버튼을 눌러 템플릿 단계를 미리본다', (tester) async {
|
||||
final template = buildTemplate();
|
||||
|
||||
when(
|
||||
() => repository.list(
|
||||
page: any(named: 'page'),
|
||||
pageSize: any(named: 'pageSize'),
|
||||
query: any(named: 'query'),
|
||||
isActive: any(named: 'isActive'),
|
||||
),
|
||||
).thenAnswer(
|
||||
(_) async => PaginatedResult<ApprovalTemplate>(
|
||||
items: [template],
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 1,
|
||||
),
|
||||
);
|
||||
|
||||
when(
|
||||
() => repository.fetchDetail(template.id, includeSteps: true),
|
||||
).thenAnswer((_) async => template);
|
||||
|
||||
await tester.pumpWidget(_buildApp(const ApprovalTemplatePage()));
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final previewFinder = find.text('보기', skipOffstage: false);
|
||||
|
||||
await tester.dragUntilVisible(
|
||||
previewFinder,
|
||||
find.text(template.name),
|
||||
const Offset(-200, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(previewFinder);
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text(template.name), findsWidgets);
|
||||
expect(find.textContaining('사번 E001'), findsOneWidget);
|
||||
|
||||
verify(
|
||||
() => repository.fetchDetail(template.id, includeSteps: true),
|
||||
).called(1);
|
||||
});
|
||||
|
||||
testWidgets('수정 플로우에서 fetchDetail 후 update를 호출한다', (tester) async {
|
||||
final activeTemplate = buildTemplate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user