<commit_before>var expect = chai.expect;

describe('Fidem provider', function () {
  var fidem, $httpBackend, $window, $rootScope, $q, $timeout, interceptors,
    logAction, expectRequest;

  beforeEach(module('fidem', function (fidemProvider, $provide) {
    fidemProvider.setApiEndpoint('http://services.fidemapps.com');
    fidemProvider.setApiKey('myApiKey');
    interceptors = fidemProvider.interceptors;

    $provide.value('$window', {
      config: 'myConfig',
      navigator: {}
    });
  }));

  beforeEach(inject(function ($injector) {
    $httpBackend = $injector.get('$httpBackend');
    fidem = $injector.get('fidem');
    $window = $injector.get('$window');
    $rootScope = $injector.get('$rootScope');
    $q = $injector.get('$q');
    $timeout = $injector.get('$timeout');

    $httpBackend.whenGET('http://services.fidemapps.com/api/members/MEMBER_ID/contests')
      .respond(200, {});

    getMemberContests = function (memberId, done) {
      fidem.getMemberContests(memberId).then(function () {
        done();
      });
      $rootScope.$digest();
    };

    expectRequest = function (memberId) {
      var url = 'http://services.fidemapps.com/api/members/' + memberId + '/contests';
      $httpBackend.expectGET(url,
        function (headers) {
          return headers['X-Fidem-AccessApiKey'] === 'myApiKey';
        }
      );
    };
  }));

  afterEach(function () {
    $httpBackend.verifyNoOutstandingExpectation();
    $httpBackend.verifyNoOutstandingRequest();
  });

  describe('get member contests', function () {
    it('should get contest', function (done) {
      expectRequest('MEMBER_ID');

      getMemberContests('MEMBER_ID', done);

      $httpBackend.flush();
    });
  });

});<commit_msg>Fix tests on Contest API<commit_after>var expect = chai.expect;

describe('Fidem provider', function () {
  var fidem, $httpBackend, $window, $rootScope, $q, $timeout, interceptors,
    logAction, expectRequest;

  beforeEach(module('fidem', function (fidemProvider, $provide) {
    fidemProvider.setApiEndpoint('http://services.fidemapps.com');
    fidemProvider.setApiKey('myApiKey');
    interceptors = fidemProvider.interceptors;

    $provide.value('$window', {
      config: 'myConfig',
      navigator: {}
    });
  }));

  beforeEach(inject(function ($injector) {
    $httpBackend = $injector.get('$httpBackend');
    fidem = $injector.get('fidem');
    $window = $injector.get('$window');
    $rootScope = $injector.get('$rootScope');
    $q = $injector.get('$q');
    $timeout = $injector.get('$timeout');

    $httpBackend.whenGET('http://services.fidemapps.com/api/contests?memberId=MEMBER_ID')
      .respond(200, {});

    getContests = function (memberId, done) {
      fidem.getContests(memberId).then(function () {
        done();
      });
      $rootScope.$digest();
    };

    expectRequest = function (memberId) {
      var url = 'http://services.fidemapps.com/api/contests?memberId=' + memberId;
      $httpBackend.expectGET(url,
        function (headers) {
          return headers['X-Fidem-AccessApiKey'] === 'myApiKey';
        }
      );
    };
  }));

  afterEach(function () {
    $httpBackend.verifyNoOutstandingExpectation();
    $httpBackend.verifyNoOutstandingRequest();
  });

  describe('get member contests', function () {
    it('should get contest', function (done) {
      expectRequest('MEMBER_ID');

      getContests('MEMBER_ID', done);

      $httpBackend.flush();
    });
  });

});
{'fraction_non_alphanumeric': 0.17061200923787528, 'fraction_numerical': 0.0017321016166281756, 'mean_word_length': 3.505851755526658, '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': '6588942', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1102, 'n_words': 165}