<commit_before>define([
    'angular',
    'app',
    'angular-mocks',
    '/views/meetings/meetings.html.js',
    'text!/base/test/unit/fixtures/meetings.json'
  ],
  function(angular, app, mocks, ctrl, fixtureMeetings) {
    describe('MeetingsCtrl', function() {
      var $http, $scope, $locale, $location, Meetings, Lists, paginator;

      var fixtures = JSON.parse(fixtureMeetings),
        upcomingMeetings = fixtures.upcoming,
        previousMeetings = fixtures.previous;

      var scope, controller, timeout;
      beforeEach(function() {
        debugger;
        mocks.module('app');

        mocks.inject(function($q, $timeout, $http, $rootScope, $locale, $location, $controller, lists, paginator) {
          timeout = $timeout;
          var meetings = {
            getMeetingsPage: function(options) {
              var deferred = $q.defer(),
                meetings = (options.timeframe === 'upcoming') ? upcomingMeetings : previousMeetings;

              $timeout(function() {
                deferred.resolve(meetings);
              }, 10);

              return deferred.promise;
            }
          };

          scope = $rootScope.$new();
          controller = $controller('MeetingsCtrl', {
            $http: $http,
            $scope: scope,
            $locale: $locale,
            $location: $location,
            meetings: meetings,
            lists: lists,
            paginator: paginator
          });

          var promise = controller.fetchMeetings({timeframe: 'upcoming'});
        });
      });

      it('should have a default timeframe', function() {
        expect(scope.timeframe).to.eql('upcoming');
      });

      it('should set filter when calling setFilter()', function() {
        // stub out update so we don't trigger requests.
        controller.updateMeetingData = sinon.stub().returns(undefined);
        controller.filterMeetings = sinon.stub().returns(undefined);
        controller.generateCountryList = sinon.stub().returns(undefined);
        controller.generateYearList = sinon.stub().returns(undefined);
        timeout.flush();

        scope.setFilter('country', {value: 'CA'});
        expect(controller.filters.country).to.eql('CA');
      });

    });

  });<commit_msg>check for loading flag<commit_after>define([
    'angular',
    'app',
    'angular-mocks',
    '/views/meetings/meetings.html.js',
    'text!/base/test/unit/fixtures/meetings.json'
  ],
  function(angular, app, mocks, ctrl, fixtureMeetings) {
    describe('MeetingsCtrl', function() {
      var $http, $scope, $locale, $location, Meetings, Lists, paginator;

      var fixtures = JSON.parse(fixtureMeetings),
        upcomingMeetings = fixtures.upcoming,
        previousMeetings = fixtures.previous;

      var scope, controller, timeout;
      beforeEach(function() {
        debugger;
        mocks.module('app');

        mocks.inject(function($q, $timeout, $http, $rootScope, $locale, $location, $controller, lists, paginator) {
          timeout = $timeout;
          var meetings = {
            getMeetingsPage: function(options) {
              var deferred = $q.defer(),
                meetings = (options.timeframe === 'upcoming') ? upcomingMeetings : previousMeetings;

              $timeout(function() {
                deferred.resolve(meetings);
              }, 10);

              return deferred.promise;
            }
          };

          scope = $rootScope.$new();
          controller = $controller('MeetingsCtrl', {
            $http: $http,
            $scope: scope,
            $locale: $locale,
            $location: $location,
            meetings: meetings,
            lists: lists,
            paginator: paginator
          });

          var promise = controller.fetchMeetings({timeframe: 'upcoming'});
        });
      });

      it('should have a default timeframe', function() {
        expect(scope.timeframe).to.eql('upcoming');
      });

      it('should set filter when calling setFilter()', function() {
        // stub out update so we don't trigger requests.
        controller.updateMeetingData = sinon.stub().returns(undefined);
        controller.filterMeetings = sinon.stub().returns(undefined);
        controller.generateCountryList = sinon.stub().returns(undefined);
        controller.generateYearList = sinon.stub().returns(undefined);

        expect(scope.loading).to.be.true;
        timeout.flush();
        expect(scope.loading).to.be.false;

        scope.setFilter('country', {value: 'CA'});
        expect(controller.filters.country).to.eql('CA');
      });

    });

  });
{'fraction_non_alphanumeric': 0.1369086548942664, 'fraction_numerical': 0.0008720296490080662, 'mean_word_length': 2.2469922151450814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1339438', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1235, 'n_words': 245}