"use strict";
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);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var react_2 = require("@testing-library/react");
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var types_1 = require("../types");
var HistoryHeader_1 = require("./HistoryHeader");
describe('HistoryHeader tests', function () {
    var filter = {
        dateRange: {
            type: mdm_sdk_1.DateRangeTypes.AGO,
            period: [4, 'month']
        },
        users: ['username1', 'username3'],
        activities: [types_1.HistoryActivityType.UPDATE, types_1.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 (0, react_2.render)(react_1.default.createElement(HistoryHeader_1.HistoryHeader, __assign({}, props)));
    };
    it('should render correctly', function () {
        setUp();
        expect(react_2.screen.getByText('History')).toBeInTheDocument();
        expect(react_2.screen.getByText('5 contributing profiles')).toBeInTheDocument();
        expect(react_2.screen.getByTestId('drop-down-menu-button')).toBeInTheDocument();
        expect(react_2.screen.getByTestId('history-filter-button')).toBeInTheDocument();
    });
    it('should render correctly for 0 profiles', function () {
        setUp(__assign(__assign({}, defaultProps), { total: 0 }));
        expect(react_2.screen.getByText('0 contributing profiles')).toBeInTheDocument();
    });
    it('should render empty state', function () {
        setUp(__assign(__assign({}, defaultProps), { total: undefined }));
        expect(react_2.screen.queryByText(/^\d+\scontributing\sprofile(s)?$/)).not.toBeInTheDocument();
        expect(react_2.screen.getByTestId('drop-down-menu-button')).toBeInTheDocument();
        expect(react_2.screen.getByTestId('history-filter-button')).toBeInTheDocument();
    });
    it('should render correctly for 1 profile', function () {
        setUp(__assign(__assign({}, defaultProps), { total: 1 }));
        expect(react_2.screen.getByText('1 contributing profile')).toBeInTheDocument();
    });
});
