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

describe('GetPerformanceReviewFormReviewStatsVC', () => {
    it('should pass validation if the user sends a valid number string', () => {
        const { errors } = getValidationClass(
            {
                responsibleId: fakePositiveInteger().toString(),
            },
            GetPerformanceReviewFormReviewStatsVC,
        );

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

    it('should pass validation if the user sends a number', () => {
        const { errors } = getValidationClass(
            {
                responsibleId: fakePositiveInteger(),
            },
            GetPerformanceReviewFormReviewStatsVC,
        );

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

    it('should fail validation if the user sends an invalid responsibleId value', () => {
        const { errors } = getValidationClass(
            {
                responsibleId: faker.word.words(),
            },
            GetPerformanceReviewFormReviewStatsVC,
        );

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

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

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