import { faker } from '@faker-js/faker/locale/en_US';
import { GetPerformanceReviewCycleReportVC } from '../../../../src/api/modules/performanceReviews/presentation/validationClasses/getPerformanceReviewCycleReportVC';
import { fakePositiveInteger } from '../../../common/common';
import { getValidationClass } from '../../../common/serializationClasses/serializationClassesHelper';

describe('GetPerformanceReviewCycleReportVC', () => {
    it('should pass validation if the user sends correct email', () => {
        const { errors } = getValidationClass(
            {
                email: faker.internet.email(),
            },
            GetPerformanceReviewCycleReportVC,
        );

        expect(errors).toHaveLength(0);
    });

    it('should pass validation if the user sends correct parameters with filters', () => {
        const { errors } = getValidationClass(
            {
                email: faker.internet.email(),
                groupIds: fakePositiveInteger().toString(),
                userFields: faker.string.uuid(),
            },
            GetPerformanceReviewCycleReportVC,
        );

        expect(errors).toHaveLength(0);
    });

    it('should validate correctly if the user sends an empty object', () => {
        const { errors } = getValidationClass({}, GetPerformanceReviewCycleReportVC);

        expect(errors).toPartiallyContain({ property: 'email' });
    });

    it('should validate correctly if the user sends an invalid email', () => {
        const { errors } = getValidationClass(
            {
                email: faker.string.uuid(),
            },
            GetPerformanceReviewCycleReportVC,
        );

        expect(errors).toPartiallyContain({ property: 'email' });
    });

    it('should validate correctly if the user sends an invalid email type', () => {
        const { errors } = getValidationClass(
            {
                email: fakePositiveInteger(),
            },
            GetPerformanceReviewCycleReportVC,
        );

        expect(errors).toPartiallyContain({ property: 'email' });
    });
});
