"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Red Hat. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
const strings_1 = require("../src/languageservice/utils/strings");
const assert_1 = __importDefault(require("assert"));
const chai_1 = require("chai");
describe('String Tests', () => {
    describe('startsWith', function () {
        it('String with different lengths', () => {
            const one = 'hello';
            const other = 'goodbye';
            const result = (0, strings_1.startsWith)(one, other);
            assert_1.default.equal(result, false);
        });
        it('String with same length different first letter', () => {
            const one = 'hello';
            const other = 'jello';
            const result = (0, strings_1.startsWith)(one, other);
            assert_1.default.equal(result, false);
        });
        it('Same string', () => {
            const one = 'hello';
            const other = 'hello';
            const result = (0, strings_1.startsWith)(one, other);
            assert_1.default.equal(result, true);
        });
    });
    describe('endsWith', function () {
        it('String with different lengths', () => {
            const one = 'hello';
            const other = 'goodbye';
            const result = (0, strings_1.endsWith)(one, other);
            assert_1.default.equal(result, false);
        });
        it('Strings that are the same', () => {
            const one = 'hello';
            const other = 'hello';
            const result = (0, strings_1.endsWith)(one, other);
            assert_1.default.equal(result, true);
        });
        it('Other is smaller then one', () => {
            const one = 'hello';
            const other = 'hi';
            const result = (0, strings_1.endsWith)(one, other);
            assert_1.default.equal(result, false);
        });
    });
    describe('convertSimple2RegExp', function () {
        it('Test of convertRegexString2RegExp', () => {
            const result = (0, strings_1.convertSimple2RegExp)('/toc\\.yml/i').test('TOC.yml');
            assert_1.default.equal(result, true);
        });
        it('Test of convertGlobalPattern2RegExp', () => {
            let result = (0, strings_1.convertSimple2RegExp)('toc.yml').test('toc.yml');
            assert_1.default.equal(result, true);
            result = (0, strings_1.convertSimple2RegExp)('toc.yml').test('TOC.yml');
            assert_1.default.equal(result, false);
        });
    });
    describe('safeCreateUnicodeRegExp', () => {
        it('should create unicode RegExp for non unicode patterns', () => {
            const result = (0, strings_1.safeCreateUnicodeRegExp)('^([2-9])\\.([0-9]+)\\.([0-9]+)(\\-[0-9a-z-]+(\\.[0-9a-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$');
            (0, chai_1.expect)(result).is.not.undefined;
        });
        it('should create unicode RegExp for non unicode patterns2', () => {
            const result = (0, strings_1.safeCreateUnicodeRegExp)('^[^\\/~\\^\\: \\[\\]\\\\]+(\\/[^\\/~\\^\\: \\[\\]\\\\]+)*$');
            (0, chai_1.expect)(result).is.not.undefined;
        });
        it('should create unicode RegExp for non unicode patterns3', () => {
            const result = (0, strings_1.safeCreateUnicodeRegExp)('^(\\s?)+=[^\\=](.+)');
            (0, chai_1.expect)(result).is.not.undefined;
        });
        it('should create unicode RegExp for non unicode patterns4', () => {
            const result = (0, strings_1.safeCreateUnicodeRegExp)('^x-[\\w\\d\\.\\-\\_]+$');
            (0, chai_1.expect)(result).is.not.undefined;
        });
        it('should create unicode RegExp for non unicode patterns5', () => {
            const result = (0, strings_1.safeCreateUnicodeRegExp)('^[\\w\\-_]+$');
            (0, chai_1.expect)(result).is.not.undefined;
        });
    });
});
//# sourceMappingURL=strings.test.js.map