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 { EntityObject } from './EntityObject';
var defaultItem = {
    id: '3vJgNLSN',
    timestamp: 1621847085259,
    objectUri: 'relations/edEnRRW',
    objectLabel: 'object label',
    data: { type: ActivityTypes.ENTITY_CHANGED }
};
var defaultProps = {
    item: defaultItem
};
var defaultMdmValues = {
    uiPath: 'https://reltio.com/nui'
};
var setUp = function (_a) {
    var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
    var Providers = function (_a) {
        var children = _a.children;
        return (React.createElement(MdmModuleProvider, { values: mdmValues }, children));
    };
    return render(React.createElement(EntityObject, __assign({}, props)), { wrapper: Providers });
};
describe('Entity object tests', function () {
    it('should render entity object correctly', function () {
        setUp();
        var link = screen.getByText('object label');
        expect(link).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~relations/edEnRRW');
        expect(link).not.toHaveClass('removed');
    });
    it('should render entity object with ENTITY_REMOVED type correctly', function () {
        var props = __assign(__assign({}, defaultProps), { item: __assign(__assign({}, defaultItem), { data: { type: ActivityTypes.ENTITY_REMOVED } }) });
        setUp({ props: props });
        expect(screen.getByText('object label')).toHaveClass('removed');
    });
});
