<commit_before>/*jshint -W068 */
'use strict';

const chai      = require('chai');
const sinon     = require('sinon');
const sinonChai = require('sinon-chai');
const http      = require('http');
const https     = require('https');
const nock      = require('nock');

chai.should();
chai.use(sinonChai);


var PiwikTracker = require('../index.js');
describe('PiwikTracker()', () => {

  it('should throw if no parameters provided', () => {
    (() => new PiwikTracker()).should.throw(/siteId/);
  });

  it('should throw if no siteId is provided', () => {
    (() => new PiwikTracker(null)).should.throw(/siteId/);
  });
    
  it('should throw if siteId provided is neither a number nor a string', () => {
    (() => new PiwikTracker({ foo: 'bar' })).should.throw(/siteId/);
    (() => new PiwikTracker([1,2,3])).should.throw(/siteId/);
    (() => new PiwikTracker(true)).should.throw(/siteId/);
    (() => new PiwikTracker(() => { return true; })).should.throw(/siteId/);
  }); 

  it('should throw if no trackerUrl is provided', () => {
    (() => new PiwikTracker(1)).should.throw(/tracker/);
  });

  it('should throw if no trackerUrl is not valid (no piwik.php endpoint)', () => {
    (() => new PiwikTracker(1,'http://example.com/index.php')).should.throw(/tracker/);
  });

  it('should have properties siteId/trackerUrl', () => {
    var piwik = new PiwikTracker(1, 'http://example.com/piwik.php');<commit_msg>Add test for string type ID<commit_after>/*jshint -W068 */
'use strict';

const chai      = require('chai');
const sinon     = require('sinon');
const sinonChai = require('sinon-chai');
const http      = require('http');
const https     = require('https');
const nock      = require('nock');

chai.should();
chai.use(sinonChai);


var PiwikTracker = require('../index.js');
describe('PiwikTracker()', () => {

  it('should throw if no parameters provided', () => {
    (() => new PiwikTracker()).should.throw(/siteId/);
  });

  it('should throw if no siteId is provided', () => {
    (() => new PiwikTracker(null)).should.throw(/siteId/);
  });

  it('should throw if siteId provided is neither a number nor a string', () => {
    (() => new PiwikTracker({ foo: 'bar' })).should.throw(/siteId/);
    (() => new PiwikTracker([1,2,3])).should.throw(/siteId/);
    (() => new PiwikTracker(true)).should.throw(/siteId/);
    (() => new PiwikTracker(() => { return true; })).should.throw(/siteId/);
    (() => new PiwikTracker(1, 'http://example.com/piwik.php')).should.not.throw();
    (() => new PiwikTracker('siteId', 'http://example.com/piwik.php')).should.not.throw();
  });

  it('should throw if no trackerUrl is provided', () => {
    (() => new PiwikTracker(1)).should.throw(/tracker/);
  });

  it('should throw if no trackerUrl is not valid (no piwik.php endpoint)', () => {
    (() => new PiwikTracker(1,'http://example.com/index.php')).should.throw(/tracker/);
  });

  it('should have properties siteId/trackerUrl', () => {
    var piwik = new PiwikTracker(1, 'http://example.com/piwik.php');
{'fraction_non_alphanumeric': 0.21986754966887417, 'fraction_numerical': 0.006291390728476821, 'mean_word_length': 3.698289269051322, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '6495290', 'n_tokens_mistral': 1041, 'n_tokens_neox': 978, 'n_words': 214}