/* Copyright CloudLinux Zug GmbH 2010-2017 All Rights Reserved
 *
 * Licensed under CLOUD LINUX LICENSE AGREEMENT
 * http://cloudlinux.com/docs/LICENSE.TXT
 */

import { LinkifyPipe } from '../app/utils/pipes/linkify';

describe('Pipe: LinkifyPipe', () => {
      let pipe: LinkifyPipe;

      beforeEach(() => {
        pipe = new LinkifyPipe();
      });

    it('with file path', () => {
        // etc.safe in file path looks like domain
        expect(pipe.transform('Check cagefs disable.etcfs exists: ' +
            '/etc/cagefs/etc.safe/disable.etcfs doesn\'t exists'))
            .toBe('Check cagefs disable.etcfs exists: ' +
                '/etc/cagefs/etc.safe/disable.etcfs doesn\'t exists');
    });

    it('with http url path', () => {
        expect(pipe.transform('Looks like your PHP handler doesn\'t support ' +
            'CloudLinux PHP Selector. ' +
            'http://docs.cloudlinux.com/index.html?compatiblity_matrix.html [error]'))
            .toBe('Looks like your PHP handler doesn\'t support ' +
            'CloudLinux PHP Selector. ' +
            '<a href="http://docs.cloudlinux.com/index.html?compatiblity_matrix.html" ' +
                'class="linkified" target="_blank">http://docs.cloudlinux.com/index.html?compatiblity_matrix.html' +
                '</a> [error]');
    });
});
