agent-ecosystem/test/shared/utils/reviewState.test.ts
iliya 5686d60d99 feat: implement startReview functionality and enhance review state management
- Added startReview function to initiate the review process for tasks, allowing transition to the review column without requiring completed status.
- Updated getCurrentReviewState and getEffectiveReviewState functions to include 'review_started' event type for accurate review state tracking.
- Enhanced task history management by introducing a new TaskReviewStartedEvent type.
- Updated documentation and user instructions to reflect the new review process, emphasizing the importance of calling review_start before review actions.
- Improved test coverage for the new startReview functionality and its integration with existing review processes.
2026-03-16 19:08:12 +02:00

37 lines
1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import {
getKanbanColumnFromReviewState,
getReviewStateFromTask,
isNeedsFixTask,
normalizeReviewState,
} from '../../../src/shared/utils/reviewState';
describe('reviewState utils', () => {
it('normalizes needsFix as a first-class review state', () => {
expect(normalizeReviewState('needsFix')).toBe('needsFix');
expect(getReviewStateFromTask({ reviewState: 'needsFix' })).toBe('needsFix');
expect(isNeedsFixTask({ reviewState: 'needsFix' })).toBe(true);
});
it('does not map needsFix to a kanban column', () => {
expect(getKanbanColumnFromReviewState('needsFix')).toBeUndefined();
});
it('derives review state from review_started history event', () => {
expect(
getReviewStateFromTask({
historyEvents: [
{
id: '1',
timestamp: '2026-01-01T00:00:00Z',
type: 'review_started',
from: 'none',
to: 'review',
actor: 'alice',
},
],
})
).toBe('review');
});
});