<commit_before>'use strict';

describe('On All songs page', function () {
    var scope, $httpBackend;

    var criteriaList = Ajabshahar.user.SongFilterConfig.filterCategories;

    var singerCategory = criteriaList[0];
    var wordCategory = criteriaList[2];

    var singerName = "<NAME>";
    var wordName = "<NAME>";

    beforeEach(module("allSongsApp"));

    beforeEach(inject(function (_$controller_, _$rootScope_, _$window_, _songsContentService_, _songMapper_, _$httpBackend_, sortService) {
        scope = _$rootScope_.$new();
        $httpBackend = _$httpBackend_;

        _$controller_('allSongsController', {
            $scope: scope,
            $window: _$window_,
            $rootScope: _$rootScope_,
            songsContentService: _songsContentService_,
            songMapper: _songMapper_,
            sortService: sortService
        });

        var resetCategories = function (category) {
            category.value = "";
            category.disabled = undefined;
            category.active = undefined;
        };
        $httpBackend.when("GET", "/api/songs/getPublishedSongs").respond(test_AllSongsList);
        resetCategories(singerCategory);
        resetCategories(wordCategory);
    }));


    describe('When its initialized', function () {
        it(' should setup filter categories and mark all the categories that have 0 items to filter on', function () {
            /*$httpBackend.when("GET", "/api/words?showOnWordsLandingPage=true").respond({"words" : [{'id': 1, 'isRootWord': true}, {'id': 2, 'isRootWord': true}]});

             scope.init();
             $httpBackend.flush();

             expect(scope.words.length).toBe(2);*/
        });

    });

    describe('When user interacts with filter pardas then', function () {


        it('clicking a category in filter parda 1, should mark the category as currently active if it not already selected and mark other categories as active=false', function () {
            $httpBackend.flush();<commit_msg>correcting a test for allSongsPage | indraneel<commit_after>'use strict';

describe('On All songs page', function() {
    var scope, $httpBackend;

    var criteriaList = Ajabshahar.user.SongFilterConfig.filterCategories;

    var singerCategory = criteriaList[0];
    var wordCategory = criteriaList[2];

    var singerName = "<NAME>";
    var wordName = "<NAME>";

    beforeEach(module("allSongsApp"));

    beforeEach(inject(function (_$controller_, _$rootScope_, _$window_, _songsContentService_, _songMapper_, _$httpBackend_, sortService) {
        scope = _$rootScope_.$new();
        $httpBackend = _$httpBackend_;

        _$controller_('allSongsController', {
            $scope: scope,
            $window: _$window_,
            $rootScope: _$rootScope_,
            songsContentService: _songsContentService_,
            songMapper:_songMapper_,
            sortService:sortService
        });

        var resetCategories = function(category){
            category.value = "";
            category.disabled = undefined;
            category.active = undefined;
        };
        $httpBackend.when("GET", "/api/songs/getPublishedSongs").respond(test_AllSongsList);
        resetCategories(singerCategory);
        resetCategories(wordCategory);
    }));


    describe('When its initialized', function() {
        iit(' should setup filter categories and mark all the categories that have 0 items to filter on as disabled', function() {
            $httpBackend.flush();

            expect(scope.filterItems.Word.length).toBe(4);
            expect(scope.filterItems.Singer.length).toBe(6);
            expect(scope.filterItems.Poet.length).toBe(3);
            expect(scope.filterItems.Gathering.length).toBe(0);
        });

    });

    describe('When user interacts with filter pardas then', function () {


        it('clicking a category in filter parda 1, should mark the category as currently active if it not already selected and mark other categories as active=false', function () {
            $httpBackend.flush();
{'fraction_non_alphanumeric': 0.116600790513834, 'fraction_numerical': 0.0037055335968379445, 'mean_word_length': 2.8746411483253587, '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': '7147475', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1049, 'n_words': 263}