"use strict";
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_hooks_1 = require("@testing-library/react-hooks");
var index_1 = require("./index");
var setUp = function (attributeUri, attributeUris) {
    var DefaultProviders = function (_a) {
        var children = _a.children;
        return (react_1.default.createElement(index_1.ExpandedAttributesProvider, { attributeUris: attributeUris }, children));
    };
    return (0, react_hooks_1.renderHook)(function (_a) {
        var attributeUri = _a.attributeUri;
        return (0, index_1.useAttributeExpanded)(attributeUri);
    }, {
        initialProps: { attributeUri: attributeUri },
        wrapper: attributeUris ? DefaultProviders : function (_a) {
            var children = _a.children;
            return react_1.default.createElement(react_1.default.Fragment, null, children);
        }
    });
};
describe('useAttributeExpanded tests', function () {
    it('should return false if no expanded context present', function () {
        var result = setUp('entities/1/attributes/Simple/1').result;
        expect(result.current).toBe(false);
    });
    it('should return false if no attributes in expanded context', function () {
        var result = setUp('entities/1/attributes/Nested/1', []).result;
        expect(result.current).toBe(false);
    });
    it('should return true if attribute in expanded context', function () {
        var result = setUp('entities/1/attributes/Nested/1', ['entities/1/attributes/Nested/1']).result;
        expect(result.current).toBe(true);
    });
    it('should return true if subnested attribute in expanded context', function () {
        var result = setUp('entities/1/attributes/Nested/1', ['entities/1/attributes/Nested/1/SubNested/1']).result;
        expect(result.current).toBe(true);
    });
});
