import { faker } from '@faker-js/faker/locale/en_US';
import { PerformanceReviewFormReviewEditRequestPaginatedSC } from '../../../../src/api/modules/performanceReviews/presentation/serializationClasses/performanceReviewFormReviewEditRequestPaginatedSC';
import { checkEditRequestSerialized, generateRandomEditRequest } from '../common';

describe('performanceReviewFormReviewEditRequestPaginatedSC', () => {
    it('should serialize edit requests', () => {
        const editRequestCount = faker.number.int({ max: 50, min: 10 });
        const editRequests = Array(editRequestCount)
            .fill(1)
            .map(() => generateRandomEditRequest());
        const editRequestsSerialized = new PerformanceReviewFormReviewEditRequestPaginatedSC().serializePaginatedList({
            count: editRequestCount,
            limit: 10,
            offset: 0,
            rows: editRequests,
        });

        expect(editRequestsSerialized.items).toHaveLength(editRequests.length);

        editRequestsSerialized.items.forEach((editRequestDTO, index) => {
            checkEditRequestSerialized(editRequests[index], editRequestDTO);
        });
    });
});
