<commit_before>/* eslint-env mocha */

'use strict';

let chai = require('chai');
let expect = chai.expect;
let dirtyChai = require('dirty-chai');
let chaiHttp = require('chai-http');
let chaiPromise = require('chai-as-promised');
let ejs = require('ejs');
let read = require('fs').readFileSync;
let join = require('path').join;

let app = require('../../app');

chai.use(dirtyChai);
chai.use(chaiHttp);
chai.use(chaiPromise);

describe('index', () => {
  let credentialFixtureCases = [
    {
      username: '',
      password: '',
      teamName: ''
    },
    {
      username: 'dummy',
      password: '',
      teamName: ''
    },
    {
      username: '',
      password: '<PASSWORD>',
      teamName: ''
    },
    {
      username: '',
      password: '',
      teamName: 'dummy'
    },
    {
      username: 'dummy',
      password: 'password',
      teamName: ''
    },
    {
      username: '',
      password: 'password',
      teamName: 'sevensource'
    },
    {
      username: 'dummy',
      password: '',
      teamName: 'sevensource'
    },
    {
      username: 'dummy',
      password: 'password',
      teamName: 'sevensource'
    }
  ];

  describe.skip('get request', () => {
    it('should contain a property called text', done => {
      // This makes a server request to the route location '/'
      chai.request(app)
            .get('/')
            .end((err, res) => {
              if (err) {
                expect.fail();
              }
              // Render the view using ejs
              let path = join(__dirname, '../../views/index.ejs');
              let data = {title: 'JamaTrace', teamName: 'defaultName', error: false};
              let rendHtml = ejs.compile(read(path, 'utf8'), {filename: path})(data);

              // Response rendered html
              let respHtml = res.text;

              expect(res).to.have.property('text');
              expect(err).to.be.null();
              expect(respHtml).to.be.equal(rendHtml);
              done();
            });
    });
  });

  describe.skip('post request', () => {
    credentialFixtureCases.forEach(fixture => {
      if (fixture.username && fixture.password && fixture.teamName) {
        it('should return true when all form fields are valid', () => {
          return chai.request(app)
            .post('/')
            .send({ username: fixture.username, password: fixture.password, teamName: fixture.teamName })
            .then(res => {<commit_msg>Removed teamname from all test files for index route<commit_after>/* eslint-env mocha */

'use strict';

let chai = require('chai');
let expect = chai.expect;
let dirtyChai = require('dirty-chai');
let chaiHttp = require('chai-http');
let chaiPromise = require('chai-as-promised');
let ejs = require('ejs');
let read = require('fs').readFileSync;
let join = require('path').join;

let app = require('../../app');

chai.use(dirtyChai);
chai.use(chaiHttp);
chai.use(chaiPromise);

describe('index', () => {
  let credentialFixtureCases = [
    {
      username: '',
      password: '',
      teamName: ''
    },
    {
      username: 'dummy',
      password: '',
      teamName: ''
    },
    {
      username: '',
      password: '<PASSWORD>',
      teamName: ''
    },
    {
      username: '',
      password: '',
      teamName: 'dummy'
    },
    {
      username: 'dummy',
      password: 'password',
      teamName: ''
    },
    {
      username: '',
      password: 'password',
      teamName: 'sevensource'
    },
    {
      username: 'dummy',
      password: '',
      teamName: 'sevensource'
    },
    {
      username: 'dummy',
      password: 'password',
      teamName: 'sevensource'
    }
  ];

  describe.skip('get request', () => {
    it('should contain a property called text', done => {
      // This makes a server request to the route location '/'
      chai.request(app)
            .get('/')
            .end((err, res) => {
              if (err) {
                expect.fail();
              }
              // Render the view using ejs
              let path = join(__dirname, '../../views/index.ejs');
              let data = {title: 'JamaTrace', error: false};
              let rendHtml = ejs.compile(read(path, 'utf8'), {filename: path})(data);

              // Response rendered html
              let respHtml = res.text;

              expect(res).to.have.property('text');
              expect(err).to.be.null();
              expect(respHtml).to.be.equal(rendHtml);
              done();
            });
    });
  });

  describe.skip('post request', () => {
    credentialFixtureCases.forEach(fixture => {
      if (fixture.username && fixture.password && fixture.teamName) {
        it('should return true when all form fields are valid', () => {
          return chai.request(app)
            .post('/')
            .send({ username: fixture.username, password: <PASSWORD>, teamName: fixture.teamName })
            .then(res => {
{'fraction_non_alphanumeric': 0.16504657756176588, 'fraction_numerical': 0.0004050222762251924, 'mean_word_length': 1.961031175059952, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 22, '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': '6052352', 'n_tokens_mistral': 1474, 'n_tokens_neox': 1465, 'n_words': 324}