<commit_before>// mocha, chai, chai-as-promised, Angular mocks

// npm install
// cd to shool-finder-frontend
// npm test

// mocha timeout and slow variables are set fairly high in karma.conf.js... I have a slow ass Windows box :(
describe('School Finder: geolocationFactory', function () {

  var $rootScope,
    $window,
    geo,
    dosuccess = true,
    failRet = {code: 2, message: 'This web browser does not support HTML5 Geolocation'};

  // setup ngMock (provides support to inject and mock Angular services into unit tests)
  beforeEach(module("sfApp", function ($provide) {
    // mocking our own window object
    var mockedWindow = {
      navigator: {
        geolocation: {
          getCurrentPosition: function (success, fail) {
            // not mocking options since we're controlling the results
            if (dosuccess) {
              setTimeout(function () {
                success({position: {coords: {latitude: 35.478, longitude: -97.519}, timestamp: 819898200}});
              }, 0);
            } else {
              setTimeout(function () {
                fail(failRet);
              }, 0);
            }
          },
          schoolfindermock: true
        }
      }
    };
    $provide.value("$window", mockedWindow);
  }));

  // injecting the real geolocationFactory and the real rootScope... using our mocked
  // window object by utilizing $provide service in the previous beforeEach<commit_msg>Refactor of setTimeout calls<commit_after>// mocha, chai, chai-as-promised, Angular mocks

// npm install
// cd to shool-finder-frontend
// npm test

// mocha timeout and slow variables are set fairly high in karma.conf.js... I have a slow ass Windows box :(
describe('School Finder: geolocationFactory', function () {

  var $rootScope,
    $window,
    geo,
    dosuccess = true,
    failRet = {code: 2, message: 'This web browser does not support HTML5 Geolocation'};

  // setup ngMock (provides support to inject and mock Angular services into unit tests)
  beforeEach(module("sfApp", function ($provide) {
    // mocking our own window object
    var mockedWindow = {
      navigator: {
        geolocation: {
          getCurrentPosition: function (success, fail) {
            // not mocking options since we're controlling the results
            setTimeout(function () {
              dosuccess ?
                success({position: {coords: {latitude: 35.478, longitude: -97.519}, timestamp: 819898200}})
                :
                fail(failRet)
            }, 0);
          },
          schoolfindermock: true
        }
      }
    };
    $provide.value("$window", mockedWindow);
  }));

  // injecting the real geolocationFactory and the real rootScope... using our mocked
  // window object by utilizing $provide service in the previous beforeEach
{'fraction_non_alphanumeric': 0.10338680926916222, 'fraction_numerical': 0.016042780748663103, 'mean_word_length': 2.3207100591715975, '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': '5273198', 'n_tokens_mistral': 823, 'n_tokens_neox': 751, 'n_words': 260}