<commit_before>import moxios from 'moxios';
import chai from 'chai';
import server from 'server';
import mockPetition from './mocks/petition';
import mockPetitions from './mocks/petitions';

const { assert } = chai;

describe('GET /', () => {
  it('redirects to /petitions', done => {
    server.injectThen('/')
      .then(response => {
        const actualStatus = response.statusCode;
        const expectedStatus = 301;

        const actualPath = response.headers.location;
        const expectedPath = '/petitions';

        assert.equal(actualStatus, expectedStatus);
        assert.equal(actualPath, expectedPath);
        done();
      });
  });
});

describe('GET /petitions', () => {
  beforeEach(() => {
    moxios.install();
  });<commit_msg>Fix home page test route to use stubbed petitions, test for 200 response.<commit_after>import moxios from 'moxios';
import chai from 'chai';
import server from 'server';
import mockPetition from './mocks/petition';
import mockPetitions from './mocks/petitions';

const { assert } = chai;

describe('GET /', () => {
  beforeEach(() => {
    moxios.install();
  });

  afterEach(() => {
    moxios.uninstall();
  });

  it('responds with 200', done => {
    moxios.stubRequest(/.*/, {
      status: 200,
      response: mockPetitions
    });

    server.injectThen('/')
      .then(response => {
        const actual = response.statusCode;
        const expected = 200;

        assert.equal(actual, expected);
        done();
      });
  });
});

describe('GET /petitions', () => {
  beforeEach(() => {
    moxios.install();
  });
{'fraction_non_alphanumeric': 0.16351010101010102, 'fraction_numerical': 0.00946969696969697, 'mean_word_length': 2.9625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '7270001', 'n_tokens_mistral': 501, 'n_tokens_neox': 470, 'n_words': 115}