<commit_before>/*globals describe, it*/

var request = require('superagent-bluebird-promise');
var chai = require('chai');
var _ = require('lodash');
var helper = require('../../tests/helpers');
var expect = chai.expect;

describe('Asynchronous', function () {

  helper.serverSpecHelper();

  it('should respond with 202 then 201', function (done) {
    request.get(helper.getUrl('/v1/route6'))
      .then(function(res) {
        expect(res.status).to.be.equal(202);
        expect(_.isEqual(res.body,{'c': 3})).to.be.ok;

        return request.get(helper.getUrl('/v1/route6'));
      })
      .then(function(res) {
        expect(res.status).to.be.equal(201);
        expect(_.isEqual(res.body, {'d': 4})).to.be.ok;
        done();
      });
  });

  it('should repeate dummy-response1.json x3 followed by a dummy-response2', function () {
    request.get(helper.getUrl('/v1/route8'))
      .then(function (res) {
        expect(res.status).to.equal(202);
        expect(_.isEqual(res.body, {'a': 1})).to.be.ok;
        return request.get(helper.getUrl('/v1/route8'));
      }).then(function (res) {
        expect(res.status).to.equal(202);
        expect(_.isEqual(res.body, {'a': 1})).to.be.ok;
        return request.get(helper.getUrl('/v1/route8'));
      }).then(function (res) {
        expect(res.status).to.equal(202);
        expect(_.isEqual(res.body, {'a': 1})).to.be.ok;
        return request.get(helper.getUrl('/v1/route8'));
      }).then(function (res) {
        expect(res.status).to.equal(201);
        expect(_.isEqual(res.body, {'b': 2})).to.be.ok;
        return request.get(helper.getUrl('/v1/route8'));
        done();<commit_msg>add async callback to repeate test<commit_after>/*globals describe, it*/

var request = require('superagent-bluebird-promise');
var chai = require('chai');
var _ = require('lodash');
var helper = require('../../tests/helpers');
var expect = chai.expect;

describe('Asynchronous', function () {

  helper.serverSpecHelper();

  it('should respond with 202 then 201', function (done) {
    request.get(helper.getUrl('/v1/route6'))
      .then(function(res) {
        expect(res.status).to.be.equal(202);
        expect(_.isEqual(res.body,{'c': 3})).to.be.ok;

        return request.get(helper.getUrl('/v1/route6'));
      })
      .then(function(res) {
        expect(res.status).to.be.equal(201);
        expect(_.isEqual(res.body, {'d': 4})).to.be.ok;
        done();
      });
  });

  it('should repeat dummy-response1.json x 3 followed by a dummy-response2', function (done) {
    request.get(helper.getUrl('/v1/route8'))
      .then(function (res) {
        expect(res.status).to.equal(202);
        expect(_.isEqual(res.body, {'a': 1})).to.be.ok;
        return request.get(helper.getUrl('/v1/route8'));
      }).then(function (res) {
        expect(res.status).to.equal(202);
        expect(_.isEqual(res.body, {'a': 1})).to.be.ok;
        return request.get(helper.getUrl('/v1/route8'));
      }).then(function (res) {
        expect(res.status).to.equal(202);
        expect(_.isEqual(res.body, {'a': 1})).to.be.ok;
        return request.get(helper.getUrl('/v1/route8'));
      }).then(function (res) {
        expect(res.status).to.equal(201);
        expect(_.isEqual(res.body, {'b': 2})).to.be.ok;
        done();
{'fraction_non_alphanumeric': 0.20554202192448234, 'fraction_numerical': 0.028014616321559074, 'mean_word_length': 2.8967971530249113, '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': '3942789', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1119, 'n_words': 172}