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 { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
import { ActivityTypes } from '../../../types';
import { SimpleActivity } from './SimpleActivity';
var defaultMdmValues = {
    uiPath: 'https://reltio.com/nui'
};
var setUp = function (_a) {
    var props = _a.props, _b = _a.mdmValues, mdmValues = _b === void 0 ? defaultMdmValues : _b;
    var Providers = function (_a) {
        var children = _a.children;
        return (React.createElement(MdmModuleProvider, { values: mdmValues }, children));
    };
    return render(React.createElement(SimpleActivity, __assign({}, props)), { wrapper: Providers });
};
describe('Simple activity tests', function () {
    it('should render correctly', function () {
        var props = {
            type: ActivityTypes.USER_LOGIN,
            data: {
                uri: 'activities/de19-08e1-b220b95c',
                user: 'polina.arsenteva',
                label: 'User login',
                timestamp: 1622625987531,
                description: '{"uri":"entities/k5nO0xA","label":"test"}',
                itemsTotal: 2
            }
        };
        setUp({ props: props });
        screen.getByText('Logged in');
        screen.getByText('(2 records)');
        expect(screen.getByText('test')).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/k5nO0xA');
    });
    it('should render correctly if description is not passed and itemsTotal is 1 or less', function () {
        var props = {
            type: ActivityTypes.USER_LOGIN,
            data: {
                uri: 'activities/de19-08e1-b220b95c',
                user: 'polina.arsenteva',
                label: 'User login',
                timestamp: 1622625987531,
                itemsTotal: 1
            }
        };
        setUp({ props: props });
        expect(screen.queryByRole('link')).not.toBeInTheDocument();
        expect(screen.queryByTestId('simple-activity-items-total')).not.toBeInTheDocument();
    });
});
