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

describe('AddPerformanceReviewTargetUserVC', () => {
    it(`should pass validation if the user sends correct parameters`, () => {
        const { errors } = getValidationClass(
            {
                userId: fakePositiveInteger(),
            },
            AddPerformanceReviewTargetUserVC,
        );

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

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

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

    it('should validate correctly if the user sends incorrect types', () => {
        const { errors } = getValidationClass(
            {
                userId: faker.word.words(),
            },
            AddPerformanceReviewTargetUserVC,
        );

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

    it('should validate correctly if the user sends null', () => {
        const { errors } = getValidationClass(
            {
                userId: null,
            },
            AddPerformanceReviewTargetUserVC,
        );

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