<commit_before>'use strict';

describe('parseStdoutService', () => {
    let parseStdoutService,
        log;

    beforeEach(angular.mock.module('Tower'));

    beforeEach(angular.mock.module('jobResults',($provide) => {
        log = jasmine.createSpyObj('$log', [
            'error'
        ]);

        $provide.value('$log', log);
    }));

    beforeEach(angular.mock.inject((_$log_, _parseStdoutService_) => {
        parseStdoutService = _parseStdoutService_;
    }));

    describe('prettify()', () => {
        it('returns lines of stdout with styling classes', () => {
            let line = "[0;32mok: [host-00][0m",
            styledLine = '<span class="ansi32">ok: [host-00]</span>';
            expect(parseStdoutService.prettify(line)).toBe(styledLine);
        });

        it('can return lines of stdout without styling classes', () => {
            let line = "[0;32mok: [host-00][0m",
            unstyled = "unstyled",
            unstyledLine = 'ok: [host-00]';
            expect(parseStdoutService.prettify(line, unstyled)).toBe(unstyledLine);
        });
    });

    describe('getLineClasses()', () => {
        xit('creates a string that is used as a class', () => {
            let headerEvent = {
                event_name: 'playbook_on_task_start',
                event_data: {
                    play_uuid:"0f667a23-d9ab-4128-a735-80566bcdbca0",
                    task_uuid: "80dd087c-268b-45e8-9aab-1083bcfd9364"
                }
            };
            let lineNum = 3;
            let line = "TASK [setup] *******************************************************************";
            let styledLine =  " header_task header_task_80dd087c-268b-45e8-9aab-1083bcfd9364 play_0f667a23-d9ab-4128-a735-80566bcdbca0 line_num_3";
            expect(parseStdoutService.getLineClasses(headerEvent, line, lineNum)).toBe(styledLine);
        });
    });

    describe('getStartTime()', () => {
        xit('creates returns a badge with the start time of the event', () => {
            let headerEvent = {
                event_name: 'playbook_on_play_start',
                created: "2016-11-22T21:15:54.736Z"
            };

            let line = "PLAY [add hosts to inventory] **************************************************";<commit_msg>update escaped parse standard out unit test<commit_after>'use strict';

describe('parseStdoutService', () => {
    let parseStdoutService,
        log;

    beforeEach(angular.mock.module('Tower'));

    beforeEach(angular.mock.module('jobResults',($provide) => {
        log = jasmine.createSpyObj('$log', [
            'error'
        ]);

        $provide.value('$log', log);
    }));

    beforeEach(angular.mock.inject((_$log_, _parseStdoutService_) => {
        parseStdoutService = _parseStdoutService_;
    }));

    describe('prettify()', () => {
        it('returns lines of stdout with styling classes', () => {
            let line = "[0;32mok: [host-00][0m",
            styledLine = '<span class="ansi32">ok: [host-00]</span>';
            expect(parseStdoutService.prettify(line)).toBe(styledLine);
        });

        it('can return lines of stdout without styling classes', () => {
            let line = "[0;32mok: [host-00][0m",
            unstyled = "unstyled",
            unstyledLine = 'ok: [host-00]';
            expect(parseStdoutService.prettify(line, unstyled)).toBe(unstyledLine);
        });

        it('can return empty strings', () => {
            expect(parseStdoutService.prettify("")).toBe("");
        });
    });

    describe('getLineClasses()', () => {
        it('creates a string that is used as a class', () => {
            let headerEvent = {
                event_name: 'playbook_on_task_start',
                event_data: {
                    play_uuid:"0f667a23-d9ab-4128-a735-80566bcdbca0",
                    task_uuid: "80dd087c-268b-45e8-9aab-1083bcfd9364"
                }
            };
            let lineNum = 3;
            let line = "TASK [setup] *******************************************************************";
            let styledLine =  " header_task header_task_80dd087c-268b-45e8-9aab-1083bcfd9364 actual_header play_0f667a23-d9ab-4128-a735-80566bcdbca0 line_num_3";
            expect(parseStdoutService.getLineClasses(headerEvent, line, lineNum)).toBe(styledLine);
        });
    });

    describe('getStartTime()', () => {
        // TODO: the problem is that the date here calls moment, and thus
        // the date will be timezone'd in the string (this could be
        // different based on where you are)
        xit('creates returns a badge with the start time of the event', () => {
            let headerEvent = {
                event_name: 'playbook_on_play_start',
                created: "2016-11-22T21:15:54.736Z"
            };

            let line = "PLAY [add hosts to inventory] **************************************************";
{'fraction_non_alphanumeric': 0.18407151564404714, 'fraction_numerical': 0.047541649735879724, 'mean_word_length': 2.3353658536585367, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5104812', 'n_tokens_mistral': 1635, 'n_tokens_neox': 1472, 'n_words': 265}