import { faker } from '@faker-js/faker/locale/en_US';
import { PerformanceReviewReviewedUsersStatsSC } from '../../../../src/api/modules/performanceReviews/presentation/serializationClasses/performanceReviewReviewedUsersStatsSC';

describe('PerformanceReviewReviewedUsersStatsSC', () => {
    it('should serialize reviewed users stats', () => {
        const userIdsWithoutBosses = Array.from(new Set(faker.helpers.multiple(faker.number.int, { count: 10 })));
        const userIdsWithBosses = userIdsWithoutBosses.splice(faker.number.int({ max: userIdsWithoutBosses.length - 1, min: 0 }));

        const reviewedUsersStats = new PerformanceReviewReviewedUsersStatsSC().serialize({ userIdsWithBosses, userIdsWithoutBosses });

        expect(reviewedUsersStats).not.toBeNull();
        expect(reviewedUsersStats.userIdsWithBosses).toBe(userIdsWithBosses);
        expect(reviewedUsersStats.userIdsWithoutBosses).toBe(userIdsWithoutBosses);
        expect(reviewedUsersStats.amountOfUsersWithBosses).toBe(userIdsWithBosses.length);
        expect(reviewedUsersStats.amountOfUsersWithoutBosses).toBe(userIdsWithoutBosses.length);
        expect(reviewedUsersStats.amountOfUsers).toBe(userIdsWithBosses.length + userIdsWithoutBosses.length);
    });
});
