"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 types_1 = require("../types");
var SimpleMatchRulesBuilder_1 = require("./SimpleMatchRulesBuilder");
describe('SimpleMatchRulesBuilder tests', function () {
    var matchRules;
    beforeEach(function () {
        matchRules = [
            { uri: 'uri1', label: 'label1' },
            { uri: 'uri2', label: 'label2', scope: 'INTERNAL', matchMethod: 'match_iq' }
        ];
    });
    it('should split match rule by ml match and other', function () {
        var TestComponent = jest.fn().mockImplementation(function () { return null; });
        (0, react_2.render)(react_1.default.createElement(SimpleMatchRulesBuilder_1.SimpleMatchRulesBuilder, { matchRules: matchRules, Component: TestComponent }));
        expect(TestComponent).toHaveBeenCalledTimes(2);
        expect(TestComponent.mock.calls[0][0]).toEqual({
            matchRules: [matchRules[0]]
        });
        expect(TestComponent.mock.calls[1][0]).toEqual({
            matchRules: [matchRules[1]],
            isMlMatch: true
        });
    });
    it('should show all rules  if varian is excludeNotMatch', function () {
        var TestComponent = jest.fn().mockImplementation(function () { return null; });
        (0, react_2.render)(react_1.default.createElement(SimpleMatchRulesBuilder_1.SimpleMatchRulesBuilder, { matchRules: matchRules, Component: TestComponent, variant: types_1.MatchRuleVariant.excludeNotMatch }));
        expect(TestComponent).toHaveBeenCalledTimes(2);
        expect(TestComponent.mock.calls[0][0]).toEqual({
            matchRules: [matchRules[0]]
        });
        expect(TestComponent.mock.calls[1][0]).toEqual({
            matchRules: [matchRules[1]],
            isMlMatch: true
        });
    });
    it('should show only simple if variant is simple', function () {
        var TestComponent = jest.fn().mockImplementation(function () { return null; });
        (0, react_2.render)(react_1.default.createElement(SimpleMatchRulesBuilder_1.SimpleMatchRulesBuilder, { matchRules: matchRules, variant: types_1.MatchRuleVariant.simple, Component: TestComponent }));
        expect(TestComponent).toHaveBeenCalledTimes(1);
        expect(TestComponent.mock.calls[0][0]).toEqual({
            matchRules: [matchRules[0]]
        });
    });
});
