import { PerformanceReviewFormTemplateSC } from '../../../../src/api/modules/performanceReviews/presentation/serializationClasses/performanceReviewFormTemplateSC';
import { fakePositiveInteger } from '../../../common/common';
import { checkPerformanceReviewFormTemplateSerialized, generateRandomPerformanceReviewFormTemplate, generateRandomTemplate } from '../common';

describe('PerformanceReviewFormTemplateSC', () => {
    it('should serialize review form template', () => {
        const reviewFormTemplate = generateRandomPerformanceReviewFormTemplate(fakePositiveInteger());
        const reviewFormTemplateSerialized = new PerformanceReviewFormTemplateSC().serialize(reviewFormTemplate);

        expect(reviewFormTemplateSerialized).not.toBeNull();

        checkPerformanceReviewFormTemplateSerialized(reviewFormTemplate, reviewFormTemplateSerialized);
    });

    it('should serialize review form template with form template details', () => {
        const reviewFormTemplate = generateRandomPerformanceReviewFormTemplate(fakePositiveInteger());
        reviewFormTemplate.template = generateRandomTemplate(reviewFormTemplate.templateId as number);
        const reviewFormTemplateSerialized = new PerformanceReviewFormTemplateSC().serialize(reviewFormTemplate);

        expect(reviewFormTemplateSerialized).not.toBeNull();

        checkPerformanceReviewFormTemplateSerialized(reviewFormTemplate, reviewFormTemplateSerialized);
    });
});
