import { faker } from '@faker-js/faker/locale/en_US';
import { PerformanceReviewExternalReviewerPaginatedSC } from '../../../../src/api/modules/performanceReviews/presentation/serializationClasses/performanceReviewExternalReviewerPaginatedSC';
import { checkPerformanceReviewExternalReviewerSerialized, generateRandomExternalReviewer } from '../common';

describe('PerformanceReviewExternalReviewerPaginatedSC', () => {
    it('should serialize external reviewer', () => {
        const externalReviewersCount = faker.number.int({ max: 50, min: 10 });
        const externalReviewers = Array(externalReviewersCount)
            .fill(1)
            .map(() => generateRandomExternalReviewer());
        const externalReviewersSerialized = new PerformanceReviewExternalReviewerPaginatedSC().serializePaginatedList({
            count: externalReviewersCount,
            limit: 10,
            offset: 0,
            rows: externalReviewers,
        });

        expect(externalReviewersSerialized.items).toHaveLength(externalReviewers.length);

        externalReviewersSerialized.items.forEach((externalReviewerDTO, index) => {
            checkPerformanceReviewExternalReviewerSerialized(externalReviewers[index], externalReviewerDTO);
        });
    });
});
