"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_2 = require("@testing-library/react");
var MatchRulesTooltip_1 = require("./MatchRulesTooltip");
describe('MatchRulesTooltip test', function () {
    it('should render correct title depending on isMlMatch prop', function () {
        var rerender = (0, react_2.render)(react_1.default.createElement(MatchRulesTooltip_1.MatchRulesTooltip, { isMlMatch: true, matchRules: [] })).rerender;
        expect(react_2.screen.queryByText(/Match rules/i)).not.toBeInTheDocument();
        rerender(react_1.default.createElement(MatchRulesTooltip_1.MatchRulesTooltip, { isMlMatch: false, matchRules: [{ uri: 'uri1', label: 'label1' }] }));
        expect(react_2.screen.getByText(/Match rules/i)).toBeInTheDocument();
    });
    it('should render match rule correctly', function () {
        var matchRules = [
            { uri: 'uri1', label: 'label1' },
            { uri: 'uri2', label: 'label2' }
        ];
        (0, react_2.render)(react_1.default.createElement(MatchRulesTooltip_1.MatchRulesTooltip, { matchRules: matchRules }));
        var ruleItems = react_2.screen.getAllByText(/^-\s+/);
        expect(ruleItems).toHaveLength(2);
        expect(ruleItems[0]).toHaveTextContent(matchRules[0].label);
        expect(ruleItems[1]).toHaveTextContent(matchRules[1].label);
    });
    it('should render negative rule correctly', function () {
        var matchRules = [
            { uri: 'uri1', label: 'label1' },
            { uri: 'uri2', label: 'label2', negativeRule: {} }
        ];
        (0, react_2.render)(react_1.default.createElement(MatchRulesTooltip_1.MatchRulesTooltip, { matchRules: matchRules }));
        var ruleItems = react_2.screen.getAllByText(/^-\s+/);
        expect(ruleItems).toHaveLength(2);
        expect(ruleItems[0]).toHaveTextContent(matchRules[0].label);
        expect(ruleItems[0].querySelector('svg')).not.toBeInTheDocument();
        expect(ruleItems[1]).toHaveTextContent(matchRules[1].label);
        expect(ruleItems[1].querySelector('svg')).toBeInTheDocument();
    });
});
