<commit_before>/**!
 *
 * Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.
 * @private
 */

import '../..';

import CiscoSpark from '@ciscospark/spark-core';
import {assert} from '@ciscospark/test-helper-chai';
import testUsers from '@ciscospark/test-helper-test-users';
import retry from '@ciscospark/test-helper-retry';

import '@ciscospark/plugin-conversation';
import '@ciscospark/plugin-wdm';

import {map, countBy} from 'lodash';
import uuid from 'uuid';
import util from 'util';

describe(`plugin-search`, () => {
  describe(`#people`, () => {
    let bot, checkov, mccoy, spark;

    before(() => testUsers.create({count: 2})
      .then((users) => {
        [checkov, mccoy] = users;

        spark = new CiscoSpark({
          credentials: {
            authorization: checkov.token
          }
        });

        return spark.mercury.connect();
      })
      .then(() => spark.request({
        api: `hydra`,
        resource: `bots`,
        method: `POST`,
        body: {
          displayName: `<NAME>`,
          email: `${uuid.v4()}@<EMAIL>`
        }
      }))
      .then((results) => {
        bot = results.body;
      })
    );

    after(() => {
      spark.mercury.disconnect();
    });

    it(`searches for users with a specific string`, () => {<commit_msg>refactor(plugin-search): name the various test setup phases to aid debugging<commit_after>/**!
 *
 * Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.
 * @private
 */

import '../..';

import CiscoSpark from '@ciscospark/spark-core';
import {assert} from '@ciscospark/test-helper-chai';
import testUsers from '@ciscospark/test-helper-test-users';
import retry from '@ciscospark/test-helper-retry';

import '@ciscospark/plugin-conversation';
import '@ciscospark/plugin-wdm';

import {map, countBy} from 'lodash';
import uuid from 'uuid';
import util from 'util';

describe(`plugin-search`, () => {
  describe(`#people`, () => {
    let bot, checkov, mccoy, spark;

    before(`create test users`, () => testUsers.create({count: 2})
      .then((users) => {
        [checkov, mccoy] = users;

        spark = new CiscoSpark({
          credentials: {
            authorization: checkov.token
          }
        });
      }));

    before(`connect to mercury`, () => spark.mercury.connect());

    before(`create bot`, () => spark.request({
      api: `hydra`,
      resource: `bots`,
      method: `POST`,
      body: {
        displayName: `Personal Assistant`,
        email: `${uuid.v4()}<EMAIL>`
      }
    })
      .then((results) => {
        bot = results.body;
      }));

    after(() => spark && spark.mercury.disconnect());

    it(`searches for users with a specific string`, () => {
{'fraction_non_alphanumeric': 0.17405764966740578, 'fraction_numerical': 0.007390983000739098, 'mean_word_length': 2.6482479784366575, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 23, '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': '4643387', 'n_tokens_mistral': 887, 'n_tokens_neox': 854, 'n_words': 200}