<commit_before>'use strict';

describe('map.directives', function () {
    var scope,
        el,
        mockService,
        deferred,
        q;

    beforeEach(function() {
        module('map.directives');
    });

    beforeEach(function() {
        mockService = {
            getVariantData: function(name) {
                deferred = q.defer();
                deferred.resolve({
                    data: {
                        name: 'standard'
                    }
                });
                return deferred.promise;
            }
        };
        spyOn(mockService, 'getVariantData').and.callThrough();
    });

    beforeEach(function() {
        inject(function ($injector, $rootScope, $compile, $q, _$timeout_) {
            scope = $rootScope.$new();
            q = $q;

            scope.variant = mockService.getVariantData('standard');
            scope.readonly = true;

            el = $compile('<sg-map variant="variant" readonly="readonly" />')(scope);
        });
    });

    it('gets variant data', function() {
        scope.readonly = true;
        scope.$digest();

        expect(mockService.getVariantData).toHaveBeenCalled();

        deferred.promise.then(function(variant) {
            expect(variant.name).toBe('standard');
        });
    });

    it('picks up the readonly flag', function() {
        scope.readonly = true;
        scope.$digest();

        var isolated = el.isolateScope();
        expect(isolated.readonly).toBe(true);
    });
});<commit_msg>Spec file cleanup<commit_after>'use strict';

describe('Map directive', function () {
    var scope,
        el,
        mockService,
        deferred,
        deferred2,
        q,
        httpBackend;

    beforeEach(function() {
        module('map.directives');
    });

    beforeEach(function() {
        mockService = {
            getVariantData: function(name) {
                deferred = q.defer();
                deferred.resolve({
                    data: {
                        name: 'standard'
                    }
                });
                return deferred.promise;
            },
            getSeasonData: function() {
                deferred2 = q.defer();
                deferred2.resolve([]);
                return deferred2.promise;
            }
        };
        spyOn(mockService, 'getVariantData').and.callThrough();
    });

    beforeEach(function() {
        inject(function ($injector, $rootScope, $compile, $q, _$httpBackend_) {
            httpBackend = _$httpBackend_;
            httpBackend.whenGET(/variants\/.+?\.svg/).respond(200, '<svg></svg>');
            
            scope = $rootScope.$new();
            q = $q;

            scope.variant = mockService.getVariantData('standard');
            scope.season = mockService.getSeasonData();
            scope.readonly = true;

            el = $compile('<sg-map variant="variant" season="season" readonly="readonly" />')(scope);
        });
    });
    
    afterEach(function() {
        httpBackend.verifyNoOutstandingExpectation();
        httpBackend.verifyNoOutstandingRequest();
    });

    it('gets variant data', function() {
        scope.$digest();

        expect(mockService.getVariantData).toHaveBeenCalled();
        
        deferred.promise.then(function(variant) {
            expect(variant.data.name).toBe('standard');
        });
    });

    it('picks up the readonly flag', function() {
        scope.$digest();

        var isolated = el.isolateScope();
        expect(isolated.readonly).toBe(true);
    });
    
    /* fit('gets the SVG map', function() {
        scope.$digest();
        httpBackend.flush();
    }); */
});
{'fraction_non_alphanumeric': 0.1417687074829932, 'fraction_numerical': 0.0019047619047619048, 'mean_word_length': 1.7049300956585725, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4145142', 'n_tokens_mistral': 1015, 'n_tokens_neox': 962, 'n_words': 163}