<commit_before>/* global module, inject, chai */
"use strict";

var pageData = hqImport('hqwebapp/js/initial_page_data');

describe('Progress Report Directive', function () {

    var $scope, $httpBackend, $location, controller;

    pageData.registerUrl('icds-ng-template', 'template');
    pageData.registerUrl('icds_locations', 'icds_locations');

    beforeEach(module('icdsApp', function ($provide) {
        $provide.constant("userLocationId", null);
    }));

    beforeEach(inject(function ($rootScope, $compile, _$httpBackend_, _$location_) {
        $scope = $rootScope.$new();
        $httpBackend = _$httpBackend_;
        $location = _$location_;

        $httpBackend.expectGET('template').respond(200, '<div></div>');
        var element = window.angular.element("<progress-report data='test'></progress-report>");
        var compiled = $compile(element)($scope);

        $httpBackend.flush();
        $scope.$digest();
        controller = compiled.controller('progressReport');
    }));

    it('tests instantiate the controller properly', function () {
        chai.expect(controller).not.to.be.a('undefined');
    });

    it('tests initial state', function () {
        assert.equal(controller.showWarning, false);
        assert.equal(controller.showPreviousMonthWarning, true);
        assert.deepEqual(controller.filtersData, {});
    });
<commit_msg>added fake date for warning message flags<commit_after>/* global module, inject, chai, sinon */
"use strict";

var pageData = hqImport('hqwebapp/js/initial_page_data');

describe('Progress Report Directive', function () {

    var $scope, $httpBackend, $location, controller, clock;

    pageData.registerUrl('icds-ng-template', 'template');
    pageData.registerUrl('icds_locations', 'icds_locations');

    beforeEach(module('icdsApp', function ($provide) {
        $provide.constant("userLocationId", null);
    }));

    beforeEach(inject(function ($rootScope, $compile, _$httpBackend_, _$location_) {
        $scope = $rootScope.$new();
        $httpBackend = _$httpBackend_;
        $location = _$location_;
        var fakeDate = new Date(2017, 9, 1);
        var clock = sinon.useFakeTimers(fakeDate.getTime());

        $httpBackend.expectGET('template').respond(200, '<div></div>');
        var element = window.angular.element("<progress-report data='test'></progress-report>");
        var compiled = $compile(element)($scope);

        $httpBackend.flush();
        $scope.$digest();
        controller = compiled.controller('progressReport');

        clock.restore();
    }));

    it('tests instantiate the controller properly', function () {
        chai.expect(controller).not.to.be.a('undefined');
    });

    it('tests initial state', function () {
        assert.equal(controller.showWarning, false);
        assert.equal(controller.showPreviousMonthWarning, true);
        assert.deepEqual(controller.filtersData, {});
    });

{'fraction_non_alphanumeric': 0.15789473684210525, 'fraction_numerical': 0.004101161995898838, 'mean_word_length': 3.698234349919743, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4673431', 'n_tokens_mistral': 846, 'n_tokens_neox': 821, 'n_words': 154}