import { PerformanceReviewFormReviewEditRequest } from '../../../../src/api/modules/performanceReviews/business/models/performanceReviewFormReviewEditRequest';
import { PerformanceReviewFormReviewEditRequestSC } from '../../../../src/api/modules/performanceReviews/presentation/serializationClasses/performanceReviewFormReviewEditRequestSC';
import { checkEditRequestSerialized, generateRandomEditRequest, generateRandomPerformanceReviewUser } from '../common';

describe('PerformanceReviewFormReviewEditRequestSC', () => {
    let editRequest: PerformanceReviewFormReviewEditRequest;

    beforeEach(() => {
        editRequest = generateRandomEditRequest();
    });

    it('should serialize editRequest without users', () => {
        const editRequestSerialized = new PerformanceReviewFormReviewEditRequestSC().serialize(editRequest);

        expect(editRequestSerialized).not.toBeNull();

        checkEditRequestSerialized(editRequest, editRequestSerialized);
    });

    it('should serialize editRequest with reviewer', () => {
        editRequest.reviewer = generateRandomPerformanceReviewUser(editRequest.reviewerId);

        const editRequestSerialized = new PerformanceReviewFormReviewEditRequestSC().serialize(editRequest);

        expect(editRequestSerialized).not.toBeNull();

        checkEditRequestSerialized(editRequest, editRequestSerialized);
    });

    it('should serialize editRequest with reviewed', () => {
        editRequest.reviewed = generateRandomPerformanceReviewUser(editRequest.reviewedId);

        const editRequestSerialized = new PerformanceReviewFormReviewEditRequestSC().serialize(editRequest);

        expect(editRequestSerialized).not.toBeNull();

        checkEditRequestSerialized(editRequest, editRequestSerialized);
    });
});
