var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import React from 'react';
import { render, screen } from '@testing-library/react';
import { DateRangeTypes } from '@reltio/mdm-sdk';
import { HistoryActivityType } from '../types';
import { HistoryHeader } from './HistoryHeader';
describe('HistoryHeader tests', function () {
    var filter = {
        dateRange: {
            type: DateRangeTypes.AGO,
            period: [4, 'month']
        },
        users: ['username1', 'username3'],
        activities: [HistoryActivityType.UPDATE, HistoryActivityType.UNMERGE],
        attributes: []
    };
    var defaultProps = {
        filter: filter,
        onApplyFilter: jest.fn(),
        onClearFilter: jest.fn(),
        entityType: {
            uri: 'configuration/entityTypes/HCA',
            label: 'HCA',
            attributes: []
        },
        total: 5
    };
    var setUp = function (props) {
        if (props === void 0) { props = defaultProps; }
        return render(React.createElement(HistoryHeader, __assign({}, props)));
    };
    it('should render correctly', function () {
        setUp();
        expect(screen.getByText('History')).toBeInTheDocument();
        expect(screen.getByText('5 contributing profiles')).toBeInTheDocument();
        expect(screen.getByTestId('drop-down-menu-button')).toBeInTheDocument();
        expect(screen.getByTestId('history-filter-button')).toBeInTheDocument();
    });
    it('should render correctly for 0 profiles', function () {
        setUp(__assign(__assign({}, defaultProps), { total: 0 }));
        expect(screen.getByText('0 contributing profiles')).toBeInTheDocument();
    });
    it('should render empty state', function () {
        setUp(__assign(__assign({}, defaultProps), { total: undefined }));
        expect(screen.queryByText(/^\d+\scontributing\sprofile(s)?$/)).not.toBeInTheDocument();
        expect(screen.getByTestId('drop-down-menu-button')).toBeInTheDocument();
        expect(screen.getByTestId('history-filter-button')).toBeInTheDocument();
    });
    it('should render correctly for 1 profile', function () {
        setUp(__assign(__assign({}, defaultProps), { total: 1 }));
        expect(screen.getByText('1 contributing profile')).toBeInTheDocument();
    });
});
