<commit_before>'use strict';

var thinky = require('thinky'),
    http = require('http'),
    express = require('express'),
    bodyParser = require('body-parser'),
    restify = require('restify'),
    chai = require('chai'),
    uuid = require('uuid');

function TestFixture() {
  this.models = {};
}

TestFixture.prototype.initializeDatabase = function() {
  var self = this;
  return new Promise(function(resolve, reject) {
    self.dbName = (uuid.v4()).replace(/-/g, '');
    self.db = thinky({
      db: self.dbName,
      silent: true
    });

    resolve();
  });
};

TestFixture.prototype.initializeServer = function() {
  var self = this;
  if (process.env.USE_RESTIFY) {
    self.server = TestFixture.app = restify.createServer();
    self.server.use(restify.queryParser());
    self.server.use(restify.bodyParser());
  } else {
    self.app = express();
    self.app.use(bodyParser.json());
    self.app.use(bodyParser.urlencoded({ extended: false }));
    self.server = http.createServer(self.app);
  }

  return new Promise(function(resolve, reject) {
    self.server.listen(0, '127.0.0.1', function() {
      self.baseUrl =
        'http://' + self.server.address().address + ':' + self.server.address().port;
      resolve();
    });
  });
};

TestFixture.prototype.clearDatabase = function() {
  var self = this, promises = [];<commit_msg>fix(test-fixture): replace typo for creating app<commit_after>'use strict';

var thinky = require('thinky'),
    http = require('http'),
    express = require('express'),
    bodyParser = require('body-parser'),
    restify = require('restify'),
    chai = require('chai'),
    uuid = require('uuid');

function TestFixture() {
  this.models = {};
}

TestFixture.prototype.initializeDatabase = function() {
  var self = this;
  return new Promise(function(resolve, reject) {
    self.dbName = (uuid.v4()).replace(/-/g, '');
    self.db = thinky({
      db: self.dbName,
      silent: true
    });

    resolve();
  });
};

TestFixture.prototype.initializeServer = function() {
  var self = this;
  if (process.env.USE_RESTIFY) {
    self.server = self.app = restify.createServer();
    self.server.use(restify.queryParser());
    self.server.use(restify.bodyParser());
  } else {
    self.app = express();
    self.app.use(bodyParser.json());
    self.app.use(bodyParser.urlencoded({ extended: false }));
    self.server = http.createServer(self.app);
  }

  return new Promise(function(resolve, reject) {
    self.server.listen(0, '127.0.0.1', function() {
      self.baseUrl =
        'http://' + self.server.address().address + ':' + self.server.address().port;
      resolve();
    });
  });
};

TestFixture.prototype.clearDatabase = function() {
  var self = this, promises = [];
{'fraction_non_alphanumeric': 0.17883211678832117, 'fraction_numerical': 0.00583941605839416, 'mean_word_length': 3.3438985736925515, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3355965', 'n_tokens_mistral': 883, 'n_tokens_neox': 874, 'n_words': 159}