<commit_before>//
// Copyright (c) 2016-2017 DrSmugleaf
//

"use strict"
require("dotenv").config({ path: __dirname + "/../.env" })
const constants = require("../libs/util/constants")
const client = require("../banterbot").client

before(function(done) {
  global.constants = constants
  global.client = client
  client.on("dbReady", () => {
    global.guild = client.guilds.get("260158980343463937")
    global.guild.createChannel("test", "text").then((channel) => {
      global.channel = channel
      done()
    })
  })
})

beforeEach(function(done) {
  setTimeout(done, 2000)
})

after(function() {
  return global.channel.delete()
})<commit_msg>Added sendTest function to mocha tests to make tests hopefully less stupid<commit_after>//
// Copyright (c) 2016-2017 DrSmugleaf
//

"use strict"
require("dotenv").config({ path: __dirname + "/../.env" })
const constants = require("../libs/util/constants")
const client = require("../banterbot").client

before(function(done) {
  global.constants = constants
  global.client = client

  client.on("dbReady", () => {
    global.guild = client.guilds.get("260158980343463937")
    global.guild.createChannel("test", "text").then((channel) => {
      global.channel = channel
      global.channel.sendTest = function(message) {
        return new Promise(function(resolve) {
          global.channel.sendMessage(message).then((initialMsg) => {
            const command = global.client.dispatcher.parseMessage(initialMsg)
            command.run()

            return global.channel.awaitMessages((m) => {
              return m.author.id === global.client.user.id && m.id !== initialMsg.id
            }, { maxMatches: 1 }).then((msg) => {
              const reply = msg.first().content.replace(`<@${global.client.user.id}>, `, "")
              resolve(reply)
            })
          })
        })
      }

      done()
    })
  })
})

beforeEach(function(done) {
  setTimeout(done, 2000)
})

after(function() {
  return global.channel.delete()
})
{'fraction_non_alphanumeric': 0.17108554277138568, 'fraction_numerical': 0.030515257628814407, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 4, '<?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': '3695758', 'n_tokens_mistral': 652, 'n_tokens_neox': 610, 'n_words': 107}