feat: 결재·마스터 실연동 업데이트

This commit is contained in:
JiWoong Sul
2025-10-14 18:10:24 +09:00
parent 1325109fba
commit 8067416c09
66 changed files with 2129 additions and 222 deletions

View File

@@ -4,6 +4,7 @@ import 'package:mocktail/mocktail.dart';
import 'package:superport_v2/core/common/models/paginated_result.dart';
import 'package:superport_v2/features/approvals/domain/entities/approval.dart';
import 'package:superport_v2/features/approvals/domain/entities/approval_template.dart';
import 'package:superport_v2/features/approvals/domain/entities/approval_proceed_status.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/presentation/controllers/approval_controller.dart';
@@ -74,6 +75,12 @@ void main() {
approvalRepository: repository,
templateRepository: templateRepository,
);
when(() => repository.canProceed(any())).thenAnswer(
(_) async => ApprovalProceedStatus(
approvalId: sampleApproval.id!,
canProceed: true,
),
);
});
// fetch 메서드 관련 시나리오
@@ -166,6 +173,8 @@ void main() {
includeHistories: true,
),
).called(1);
verify(() => repository.canProceed(1)).called(1);
expect(controller.canProceedSelected, isTrue);
});
test('에러 발생 시 errorMessage 설정', () async {
@@ -369,6 +378,30 @@ void main() {
expect(controller.isPerformingAction, isFalse);
});
test('canProceed가 false면 액션을 중단한다', () async {
when(() => repository.canProceed(any())).thenAnswer(
(_) async => ApprovalProceedStatus(
approvalId: sampleApproval.id!,
canProceed: false,
reason: '선행 단계가 완료되지 않았습니다.',
),
);
await controller.loadActionOptions(force: true);
await controller.fetch();
await controller.selectApproval(sampleApproval.id!);
final success = await controller.performStepAction(
step: sampleStep,
type: ApprovalStepActionType.approve,
);
expect(success, isFalse);
expect(controller.errorMessage, contains('선행 단계'));
expect(controller.canProceedSelected, isFalse);
verifyNever(() => repository.performStepAction(any()));
});
test('행위를 찾지 못하면 요청하지 않는다', () async {
when(
() => repository.listActions(activeOnly: any(named: 'activeOnly')),