{"size": 893, "ext": "js", "max_stars_repo_path": "test/1.6.1/server/log.js", "max_stars_repo_name": "dominicbarnes/nock-couchdb", "max_stars_repo_stars_event_min_datetime": "2015-02-19T15:41:13.000Z", "max_stars_repo_stars_event_max_datetime": "2015-02-19T15:41:13.000Z", "max_issues_repo_path": "test/1.6.1/server/log.js", "max_issues_repo_name": "dominicbarnes/nock-couchdb", "max_issues_repo_issues_event_min_datetime": "2015-01-17T06:10:01.000Z", "max_issues_repo_issues_event_max_datetime": "2015-01-17T06:21:36.000Z", "max_forks_repo_path": "test/1.6.1/server/log.js", "max_forks_repo_name": "dominicbarnes/nock-couchdb", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 9, "max_forks_count": null, "avg_line_length": 26.2647058824, "max_line_length": 58, "alphanum_fraction": 0.5991041433}
var assert = require('assert');
var supertest = require('supertest');
var mock = require('../../..');
var status = mock.status;

module.exports = function () {
  var server = mock.server();
  var request = supertest(server.url());
  var version = server.options.version;

  afterEach(function () {
    server.mock.done();
  });

  it('should mock a successful request', function (done) {
    server.log();

    request
      .get('_log')
      .expect(status.OK)
      .expect('Cache-Control', 'must-revalidate')
      .expect('Content-Type', 'text/plain; charset=utf-8')
      .expect('Date', server.options.date.toUTCString())
      .expect('Transfer-Encoding', 'chunked')
      .expect('Server', `CouchDB/${version} (Erlang/OTP)`)
      .expect(function (res) {
        var data = res.text;
        assert(data);
        assert.equal(data.length, 1000);
      })
      .end(done);
  });
};
