<commit_before>/**
 * Created by Kylart on 21/05/2017.
 */

require('colors')
const test = require('ava')
const axios = require('axios')
const express = require('express')
const {join} = require('path')
const rimraf = require('rimraf')
const {readFile, writeFileSync} = require('fs')
const {userInfo} = require('os')
const {existsSync} = require('fs')

process.env.NODE_ENV = 'KawAnime-test'

// We keep the server instance
// So we can close it at the end of the test
let server = null
const uri = 'http://localhost:4000'

const DIR = join(userInfo().homedir, '.KawAnime-test')
const kawAnimeFilesPath = {
  local: join(DIR, 'locals.json'),
  history: join(DIR, 'history.json'),
  watchList: join(DIR, 'lists.json'),
  config: join(DIR, 'config.json'),
  token: join(DIR, '_token'),
  vault: {
    base: join(DIR, 'vault'),
    key: join(DIR, 'vault', 'p'),
    mal: join(DIR, 'vault', 'mal.bcup')
  }
}

// Init server listening on localhost:4000
test.before('Init server', async () => {
  /**
   * Creating .KawAnime-test directory and necessary files
   */
  const app = express()
  require('../server')(app)

  /**<commit_msg>Fix server tests<commit_after>/**
 * Created by Kylart on 21/05/2017.
 */

require('colors')
const test = require('ava')
const axios = require('axios')
const express = require('express')
const {join} = require('path')
const rimraf = require('rimraf')
const {readFile, writeFileSync} = require('fs')
const {userInfo} = require('os')
const {existsSync} = require('fs')

process.env.NODE_ENV = 'KawAnime-test'

// We keep the server instance
// So we can close it at the end of the test
let server = null
const uri = 'http://localhost:4000'

const DIR = join(userInfo().homedir, '.KawAnime-test')
const kawAnimeFilesPath = {
  local: join(DIR, 'locals.json'),
  history: join(DIR, 'history.json'),
  watchList: join(DIR, 'lists.json'),
  config: join(DIR, 'config.json'),
  token: join(DIR, '_token'),
  vault: {
    base: join(DIR, 'vault'),
    key: join(DIR, 'vault', 'p'),
    mal: join(DIR, 'vault', 'mal.bcup')
  }
}

// Init server listening on localhost:4000
test.before('Init server', async () => {
  /**
   * Creating .KawAnime-test directory and necessary files
   */
  const app = express()
  require('../app/main/server')(app)

  /**
{'fraction_non_alphanumeric': 0.1785400175901495, 'fraction_numerical': 0.014072119613016711, 'mean_word_length': 4.182232346241458, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7617650', 'n_tokens_mistral': 807, 'n_tokens_neox': 778, 'n_words': 216}