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 { RelationObject } from './RelationObject';
var defaultItem = {
    id: '3vJgNLSN',
    timestamp: 1621847085259,
    objectUri: 'relations/edEnRRW',
    objectType: 'configuration/relationTypes/HasAddress',
    startObjectUri: 'entities/sOoSQYm',
    startObjectLabel: 'start object label',
    endObjectUri: 'entities/1BVkicLG',
    endObjectLabel: 'end object label',
    data: { type: ActivityTypes.RELATIONSHIP_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(RelationObject, __assign({}, props)), { wrapper: Providers });
};
describe('Relation object tests', function () {
    it('should render correctly', function () {
        setUp();
        var links = screen.getAllByRole('link');
        expect(links[0]).toHaveTextContent('start object label');
        expect(links[0]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/sOoSQYm');
        expect(links[1]).toHaveTextContent('end object label');
        expect(links[1]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/1BVkicLG');
    });
});
