{"size": 953, "ext": "js", "max_stars_repo_path": "test/app.js", "max_stars_repo_name": "hex7c0/timeout-request", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/app.js", "max_issues_repo_name": "hex7c0/timeout-request", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/app.js", "max_forks_repo_name": "hex7c0/timeout-request", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 17.6481481481, "max_line_length": 79, "alphanum_fraction": 0.5855194124}
'use strict';
/**
 * @file app test
 * @module timeout-request
 * @subpackage test
 * @version 0.0.1
 * @author hex7c0 <hex7c0@gmail.com>
 * @license GPLv3
 */

/*
 * initialize module
 */
var timeout = require('..');
var express = require('express');
var request = require('supertest');

/*
 * test module
 */
describe('app', function() {

  var milliseconds = 800;
  var app;

  beforeEach(function(done) {

    app = express();
    done();
  });

  it('should get 200 after 800 milliseconds', function(done) {

    app.use(timeout({
      milliseconds: milliseconds
    })).get('/', function(req, res) {

      // pass
    });
    request(app).get('/').expect(200, done);
  });
  it('should get 200 after 800 milliseconds and after header', function(done) {

    app.use(timeout({
      header: true,
      milliseconds: milliseconds
    })).get('/', function(req, res) {

      // pass
    });
    request(app).get('/').expect(200, done);
  });
});
