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 { AttributeGroupIcon } from './AttributeGroupIcon';
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
describe('AttributeGroupIcon tests', function () {
    var absoluteImagePath = 'https://s3.amazonaws.com/reltio.images/api';
    var setUp = function (props) {
        var Providers = function (_a) {
            var children = _a.children;
            return (React.createElement(MdmModuleProvider, { values: { absoluteImagePath: absoluteImagePath } }, children));
        };
        return render(React.createElement(AttributeGroupIcon, __assign({}, props)), { wrapper: Providers });
    };
    it('should render AvatarWithFallback with first letter of title', function () {
        var group = { id: 'group', title: 'Entity type' };
        var metadata = { entityTypes: [] };
        setUp({ group: group, metadata: metadata });
        screen.getByText('E');
        expect(screen.queryByRole('img')).not.toBeInTheDocument();
    });
    it('should render AvatarWithFallback with icon if icon exists', function () {
        var entityTypeUri = 'configuration/entityTypes/EntityType1';
        var typeGraphIcon = 'images/graphIcon/entity-type-icon.png';
        var metadata = {
            entityTypes: [
                {
                    attributes: [],
                    uri: entityTypeUri,
                    typeGraphIcon: typeGraphIcon
                }
            ]
        };
        var group = {
            id: entityTypeUri,
            title: 'Icon Entity type'
        };
        setUp({ group: group, metadata: metadata });
        expect(screen.getByRole('img')).toHaveAttribute('src', "".concat(absoluteImagePath, "/").concat(typeGraphIcon));
    });
});
