import { faker } from '@faker-js/faker/locale/en_US';
import { PerformanceReviewCyclePaginatedSC } from '../../../../src/api/modules/performanceReviews/presentation/serializationClasses/performanceReviewCyclePaginatedSC';
import { checkPerformanceReviewCycleSerialized, generateRandomPerformanceReviewCycle } from '../common';

describe('PerformanceReviewCyclePaginatedSC', () => {
    it('should serialize review cycle without form templates', () => {
        const reviewCyclesCount = faker.number.int({ max: 50, min: 10 });
        const reviewCycles = Array(reviewCyclesCount)
            .fill(1)
            .map(() => generateRandomPerformanceReviewCycle());
        const reviewCyclesSerialized = new PerformanceReviewCyclePaginatedSC().serializePaginatedList({
            count: reviewCyclesCount,
            limit: 10,
            offset: 0,
            rows: reviewCycles,
        });

        expect(reviewCyclesSerialized.items).toHaveLength(reviewCycles.length);

        reviewCyclesSerialized.items.forEach((reviewCycleDTO, index) => {
            checkPerformanceReviewCycleSerialized(reviewCycles[index], reviewCycleDTO);
        });
    });
});
