<commit_before>var expect = require('chai').expect;
var request = require('supertest');
var bodyParser = require('body-parser');

var conf = require('../../../app/config');

var apiSuffix = conf.get('apiSuffix');
var authHeader = {'Authorization': 'Bearer ' + conf.get('apiKey')}

var app = require('../../../app');
app.use(bodyParser.urlencoded({
  extended: true
}));

describe('authentication', function() {
  it('should be unauthorised if using wrong credentials', function(done) {
    request(app)
      .get(apiSuffix)
      .end(function(err, res) {
        expect(res.statusCode).to.equal(401);
        done();
      });
  });
});
<commit_msg>Added test for authorisation if using correct credentials<commit_after>var expect = require('chai').expect;
var request = require('supertest');
var bodyParser = require('body-parser');

var conf = require('../../../app/config');

var apiSuffix = conf.get('apiSuffix');
var authHeader = {'Authorization': 'Bearer ' + conf.get('apiKey')}

var app = require('../../../app');
app.use(bodyParser.urlencoded({
  extended: true
}));

describe('authorisation', function() {
  it('should be unauthorised if using wrong credentials', function(done) {
    request(app)
      .get(apiSuffix)
      .end(function(err, res) {
        expect(res.statusCode).to.equal(401);
        done();
      });
  });

  it('should be authorised if using correct credentials', function(done) {
    request(app)
      .get(apiSuffix)
      .set(authHeader)
      .end(function(err, res) {
        expect(res.statusCode).to.equal(200);
        done();
      });
  });
});

{'fraction_non_alphanumeric': 0.18706842435655996, 'fraction_numerical': 0.005649717514124294, 'mean_word_length': 3.5028248587570623, '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': '6621939', 'n_tokens_mistral': 500, 'n_tokens_neox': 490, 'n_words': 106}