ef20839f99
Phase 1-2: Setup, SQL schema, enums, queue constants, base entities
Phase 3 (US1): ReviewTeam, ReviewTeamMember, ReviewTask, TaskCreationService
Phase 4 (US2): ResponseCode, ResponseCodeRule, ImplicationsService, NotificationTriggerService
Phase 5 (US3): Delegation entity, CircularDetectionService, DelegationService/Controller/Module
Phase 6 (US4): ReminderRule, SchedulerService, EscalationService, ReminderProcessor, ReminderModule
Phase 7 (US5): DistributionMatrix, DistributionRecipient, ApprovalListenerService (Strangler),
TransmittalCreatorService, DistributionProcessor, DistributionModule
Phase 8 (US6): MatrixManagementService, InheritanceService (global→project override)
Phase 9 (Polish): AggregateStatusService, ConsensusService, VetoOverrideService,
ParallelGatewayHandler, review-validators, optimistic locking in completeReview,
test stubs (unit/integration/e2e), jest.config.js updated for tests/ directory
Frontend: ReviewTaskInbox, ParallelProgress, VetoOverrideDialog, DelegationForm,
DelegatedBadge, MatrixEditor, ProjectOverrideManager, DistributionStatus,
ReminderHistory, ResponseCodeSelector, CodeImplications, CompleteReviewForm,
ReviewTeamForm, ReviewTeamSelector, TeamMemberManager
Closes #1
50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
// File: tests/integration/review-team/parallel-review.spec.ts
|
|
// Integration tests สำหรับ Parallel Review consensus flow (T076)
|
|
// TODO: ขยาย test suite เมื่อ test database พร้อม (Sprint ถัดไป)
|
|
|
|
import { ConsensusDecision } from '../../../src/modules/common/enums/review.enums';
|
|
|
|
describe('Parallel Review Consensus (Integration)', () => {
|
|
describe('Consensus evaluation', () => {
|
|
it('should return APPROVED when all tasks have Code 1A', () => {
|
|
const codes = ['1A', '1A', '1A'];
|
|
const hasVeto = codes.some((c) => c === '3');
|
|
const allApproved = codes.every((c) => ['1A', '1B'].includes(c));
|
|
|
|
const decision = hasVeto
|
|
? ConsensusDecision.REJECTED
|
|
: allApproved
|
|
? ConsensusDecision.APPROVED
|
|
: ConsensusDecision.APPROVED_WITH_COMMENTS;
|
|
|
|
expect(decision).toBe(ConsensusDecision.APPROVED);
|
|
});
|
|
|
|
it('should return REJECTED when any task has Code 3', () => {
|
|
const codes = ['1A', '3', '2'];
|
|
const hasVeto = codes.some((c) => c === '3');
|
|
|
|
const decision = hasVeto ? ConsensusDecision.REJECTED : ConsensusDecision.APPROVED;
|
|
|
|
expect(decision).toBe(ConsensusDecision.REJECTED);
|
|
});
|
|
|
|
it('should return APPROVED_WITH_COMMENTS when mix of 1A and 2', () => {
|
|
const codes = ['1A', '2', '1B'];
|
|
const hasVeto = codes.some((c) => c === '3');
|
|
const allApproved = codes.every((c) => ['1A', '1B'].includes(c));
|
|
const hasComments = codes.some((c) => c === '2');
|
|
|
|
const decision = hasVeto
|
|
? ConsensusDecision.REJECTED
|
|
: allApproved
|
|
? ConsensusDecision.APPROVED
|
|
: hasComments
|
|
? ConsensusDecision.APPROVED_WITH_COMMENTS
|
|
: ConsensusDecision.PENDING;
|
|
|
|
expect(decision).toBe(ConsensusDecision.APPROVED_WITH_COMMENTS);
|
|
});
|
|
});
|
|
});
|