import { PerformanceReviewFormShareStatus } from '../../../../src/api/modules/performanceReviews/business/types/performanceReviewFormShareStatus';
import { PerformanceReviewDeliveryStatsSC } from '../../../../src/api/modules/performanceReviews/presentation/serializationClasses/performanceReviewDeliveryStatsSC';
import { generateRandomReviewCountsForShareStatuses } from '../common';

describe('PerformanceReviewDeliveryStatsSC', () => {
    it('should serialize reviewed users stats', () => {
        const statuses = Object.values(PerformanceReviewFormShareStatus);
        const stats = generateRandomReviewCountsForShareStatuses(statuses);

        const serializedStats = new PerformanceReviewDeliveryStatsSC().serialize(stats);

        expect(serializedStats).not.toBeNull();
        expect(Object.keys(serializedStats.totalStats)).toHaveLength(statuses.length);

        Object.keys(serializedStats.totalStats).forEach((status) => {
            expect(serializedStats.totalStats[status]).toBe(stats[status]);
        });
    });
});
