"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 MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
var types_1 = require("../types");
var EntityObject_1 = require("./EntityObject");
var defaultItem = {
    id: '3vJgNLSN',
    timestamp: 1621847085259,
    objectUri: 'relations/edEnRRW',
    objectLabel: 'object label',
    data: { type: types_1.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_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues }, children));
    };
    return (0, react_2.render)(react_1.default.createElement(EntityObject_1.EntityObject, __assign({}, props)), { wrapper: Providers });
};
describe('Entity object tests', function () {
    it('should render entity object correctly', function () {
        setUp();
        var link = react_2.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: types_1.ActivityTypes.ENTITY_REMOVED } }) });
        setUp({ props: props });
        expect(react_2.screen.getByText('object label')).toHaveClass('removed');
    });
});
