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

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

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

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

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

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

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

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

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