<commit_before>'use strict';

var Github = require('../src/github.js');
var testUser = require('./user.json');
var github, user;

describe('Github constructor', function() {
   before(function() {
      github = new Github({
         username: testUser.USERNAME,
         password: <PASSWORD>,
         auth: 'basic'
      });

      user = github.getUser();
   });

   it('should authenticate and return no errors', function(done) {
      user.notifications(function(err) {
         should.not.exist(err);
         done();
      });
   });
});

describe('Github constructor (failing case)', function() {
   before(function() {
      github = new Github({
         username: testUser.USERNAME,
         password: '<PASSWORD>',
         auth: 'basic'
      });

      user = github.getUser();
   });

   it('should fail authentication and return err', function(done) {
      user.notifications(function(err) {
         err.error.should.equal(401, 'Return 401 status for bad auth');
         err.request.message.should.equal('Bad credentials');
         done();
      });
   });
});<commit_msg>Tests: Updated auth tests due to the restore of the XHR object<commit_after>'use strict';

var Github = require('../src/github.js');
var testUser = require('./user.json');
var github, user;

describe('Github constructor', function() {
   before(function() {
      github = new Github({
         username: testUser.USERNAME,
         password: <PASSWORD>,
         auth: 'basic'
      });

      user = github.getUser();
   });

   it('should authenticate and return no errors', function(done) {
      user.notifications(function(err) {
         should.not.exist(err);
         done();
      });
   });
});

describe('Github constructor (failing case)', function() {
   before(function() {
      github = new Github({
         username: testUser.USERNAME,
         password: '<PASSWORD>',
         auth: 'basic'
      });

      user = github.getUser();
   });

   it('should fail authentication and return err', function(done) {
      user.notifications(function(err) {
         err.error.should.equal(401, 'Return 401 status for bad auth');
         JSON.parse(err.request.responseText).message.should.equal('Bad credentials');
         done();
      });
   });
});
{'fraction_non_alphanumeric': 0.15544729849424269, 'fraction_numerical': 0.005314437555358724, 'mean_word_length': 2.5971337579617835, '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': '6298341', 'n_tokens_mistral': 665, 'n_tokens_neox': 632, 'n_words': 153}