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 { EntityTypeIcon } from './EntityTypeIcon';
var defaultProps = {
    entityType: { uri: 'configuration/entityTypes/HCP', typeIcon: 'entity_icons/individual.svg' }
};
var setUp = function (_a) {
    var _b = _a.props, props = _b === void 0 ? defaultProps : _b, imagePath = _a.imagePath;
    var Providers = function (_a) {
        var children = _a.children;
        return (React.createElement(MdmModuleProvider, { values: { absoluteImagePath: imagePath } }, children));
    };
    return render(React.createElement(EntityTypeIcon, __assign({}, props)), { wrapper: Providers });
};
describe('Entity type icon tests', function () {
    it('should render EntityTypeIcon from react-components with storagePath from store', function () {
        var imagePath = '/some/image/path/';
        setUp({ imagePath: imagePath });
        expect(screen.getByRole('img')).toHaveAttribute('src', '/some/image/path/entity_icons/individual.svg');
    });
    it('should ensure slash ending for storagePath', function () {
        var imagePath = '/some/image/path';
        setUp({ imagePath: imagePath });
        expect(screen.getByRole('img')).toHaveAttribute('src', '/some/image/path/entity_icons/individual.svg');
    });
});
