import { faker } from '@faker-js/faker/locale/en_US';
import { PerformanceReviewTemplatePaginatedSC } from '../../../../src/api/modules/performanceReviews/presentation/serializationClasses/performanceReviewTemplatePaginatedSC';
import { checkTemplateSerialized, generateRandomTemplate } from '../common';

describe('PerformanceReviewTemplatePaginatedSC', () => {
    it('should serialize performance review templates', () => {
        const templatesCount = faker.number.int({ max: 50, min: 10 });
        const formTemplates = Array(templatesCount)
            .fill(1)
            .map(() => generateRandomTemplate());
        const templatesSerialized = new PerformanceReviewTemplatePaginatedSC().serializePaginatedList({
            count: templatesCount,
            limit: 10,
            offset: 0,
            rows: formTemplates,
        });

        expect(templatesSerialized.items).toHaveLength(formTemplates.length);

        templatesSerialized.items.forEach((templateDTO, index) => {
            checkTemplateSerialized(formTemplates[index], templateDTO);
        });
    });
});
