<commit_before>/*
 * Ping the APIs only one test suite
 */

var
  vows = require('vows'),
  assert = require('assert');

var
  quero = {},
  urls = [{identifier: 'google homepage', url: 'http://google.com'}];

function checkQueryResults (result) {

  return (result.hasOwnProperty('linkedin') ||
    result.hasOwnProperty('stumbleupon') ||
    result.hasOwnProperty('facebook') ||
    result.hasOwnProperty('twitter') ||
    result.hasOwnProperty('pinterest'));
}

vows.describe('Should throw an Error if an array of urls is empty')
  .addBatch({
  'Load module': {
    topic: function () {
      quero = require('./../');
      return quero;
    },
    'should be loaded': function (topic) {
      assert.isObject(topic);
      assert.isNotNull(topic);
    },
    'should have a ping function': function (topic) {
      assert.isFunction(topic.ping);
    },
    'Handle one URL': {
      topic: function (quero) {
        quero.ping([], this.callback);
      },
      'should throw an error': function (err, result) {
        assert.isNotNull(err);
        assert.throws(err, Error);
        assert.equal(err.message, 'We need one or more of valid URLs');
        assert.isUndefined(result);
      }
    }
  }
})
  .export(module);

vows.describe('Should be able to ping one URL')
  .addBatch({
  'Load module': {
    topic: function () {
      quero = require('./../');
      return quero;
    },
    'should be loaded': function (topic) {
      assert.isObject(topic);
      assert.isNotNull(topic);
    },
    'should have a ping function': function (topic) {
      assert.isFunction(topic.ping);
    },
    'Handle one URL': {
      topic: function (quero) {
        quero.ping(urls, this.callback);
      },
      'should return a result if succeed': function (err, result) {
        console.log('result', result);
        assert.isNull(err);
        assert.isObject(result);
        assert.isTrue(checkQueryResults(result));
      }
    }
  }
})
  .export(module);<commit_msg>Remove temp logging on unit test<commit_after>/*
 * Ping the APIs only one test suite
 */

var
  vows = require('vows'),
  assert = require('assert');

var
  quero = {},
  urls = [{identifier: 'google homepage', url: 'http://google.com'}];

function checkQueryResults (result) {

  return (result.hasOwnProperty('linkedin') ||
    result.hasOwnProperty('stumbleupon') ||
    result.hasOwnProperty('facebook') ||
    result.hasOwnProperty('twitter') ||
    result.hasOwnProperty('pinterest'));
}

vows.describe('Should throw an Error if an array of urls is empty')
  .addBatch({
  'Load module': {
    topic: function () {
      quero = require('./../');
      return quero;
    },
    'should be loaded': function (topic) {
      assert.isObject(topic);
      assert.isNotNull(topic);
    },
    'should have a ping function': function (topic) {
      assert.isFunction(topic.ping);
    },
    'Handle one URL': {
      topic: function (quero) {
        quero.ping([], this.callback);
      },
      'should throw an error': function (err, result) {
        assert.isNotNull(err);
        assert.throws(err, Error);
        assert.equal(err.message, 'We need one or more of valid URLs');
        assert.isUndefined(result);
      }
    }
  }
})
  .export(module);

vows.describe('Should be able to ping one URL')
  .addBatch({
  'Load module': {
    topic: function () {
      quero = require('./../');
      return quero;
    },
    'should be loaded': function (topic) {
      assert.isObject(topic);
      assert.isNotNull(topic);
    },
    'should have a ping function': function (topic) {
      assert.isFunction(topic.ping);
    },
    'Handle one URL': {
      topic: function (quero) {
        quero.ping(urls, this.callback);
      },
      'should return a result if succeed': function (err, result) {
        assert.isNull(err);
        assert.isObject(result);
        assert.isTrue(checkQueryResults(result));
      }
    }
  }
})
  .export(module);
{'fraction_non_alphanumeric': 0.15382665990876837, 'fraction_numerical': 0.0, 'mean_word_length': 2.6512488436632746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1761722', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1215, 'n_words': 298}