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

describe('RequestPerformanceReviewFormReviewEditVC', () => {
    it(`should pass validation if the user sends a correct description`, () => {
        const { errors } = getValidationClass(
            {
                description: faker.word.words(),
            },
            RequestPerformanceReviewFormReviewEditVC,
        );

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

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

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

    it('should validate correctly if the user sends incorrect description', () => {
        const { errors } = getValidationClass(
            {
                description: faker.datatype.boolean(),
            },
            RequestPerformanceReviewFormReviewEditVC,
        );

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

    it(`should validate correctly if the user sends '' as description`, () => {
        const { errors } = getValidationClass(
            {
                description: '',
            },
            RequestPerformanceReviewFormReviewEditVC,
        );

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