<commit_before>var _ = require("lodash");
var moment = require("moment");

var liveServer = require("./server-single");

liveServer(null, function (err, server) {
  if (err) { throw err; }

  // load db with test data
  // Test 'batch'
  // Test 'batch'
  var testSurveys = [
    {
      periodStart: moment("20140101", "YYYYMMDD").toISOString(),
      periodEnd: moment("20140115", "YYYYMMDD").toISOString(),
      projectName: "Foo Project",
      creatorEmail: "<EMAIL>",
      emails: [
        {
          email: "<EMAIL>",
          name: "ExampleHi"
        },
        {
          email: "<EMAIL>",
          name: "ExampleLo"
        }
      ]
    },
    {
      periodStart: moment("20140115", "YYYYMMDD").toISOString(),
      periodEnd: moment("20140130", "YYYYMMDD").toISOString(),
      projectName: "Bar Project",
      creatorEmail: "<EMAIL>",
      emails: [
        {
          email: "<EMAIL>",
          name: "ExampleHi"
        },
        {
          email: "<EMAIL>",
          name: "ExampleHiLo"
        }
      ]
    }
  ];

  // Add records
  server.inject({
    method: "POST",
    url: "/surveys/batch",
    payload: testSurveys
  }, function (res) {
    if (res.statusCode !== 200) {
      throw new Error("records failed to load");
    }

    var body = JSON.parse(res.payload);

    // Create link from newly created record tokens
    var link = _.find(body.tokensByEmail, function (response) {
      return response.email === "<EMAIL>";
    })
      .tokens
      .join("...");

    // Add result for one of those records
    server.inject({
      method: "POST",<commit_msg>Require test data into server-mock<commit_after>var _ = require("lodash");

var liveServer = require("./server-single");

// A batch of surveys to mock with
var testSurveys = require("../test/api/survey-data");

liveServer(null, function (err, server) {
  if (err) { throw err; }

  // Add records
  server.inject({
    method: "POST",
    url: "/surveys/batch",
    payload: testSurveys
  }, function (res) {
    if (res.statusCode !== 200) {
      throw new Error("records failed to load");
    }

    var body = JSON.parse(res.payload);

    // Create link from newly created record tokens
    var link = _.find(body.tokensByEmail, function (response) {
      return response.email === "<EMAIL>";
    })
      .tokens
      .join("...");

    // Add result for one of those records
    server.inject({
      method: "POST",
{'fraction_non_alphanumeric': 0.15542763157894737, 'fraction_numerical': 0.015625, 'mean_word_length': 2.274562584118439, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3696372', 'n_tokens_mistral': 787, 'n_tokens_neox': 749, 'n_words': 193}