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

describe('PerformanceReviewTemplateVC', () => {
    it('should validate correctly an empty object', () => {
        const { errors } = getValidationClass({}, PerformanceReviewTemplateVC);
        ['title'].forEach((property) => {
            expect(errors).toPartiallyContain({ property });
        });
    });

    it('should validate correctly if the user send incorrect type text values', () => {
        const { errors } = getValidationClass(
            {
                description: faker.datatype.boolean(),
                title: faker.datatype.boolean(),
            },
            PerformanceReviewTemplateVC,
        );
        ['description', 'title'].forEach((property) => {
            expect(errors).toPartiallyContain({ property });
        });
    });

    it(`should validate correctly if send '' as description`, () => {
        const { errors } = getValidationClass(
            {
                description: '',
            },
            PerformanceReviewTemplateVC,
        );

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