<commit_before>'use strict';

var chai = require('chai');
var should = chai.should();
var expect = chai.expect;
var assert = chai.assert;

var ZohoSubscriptions = require('../lib');

var credentials = JSON.parse(require('fs').readFileSync(__dirname + '/../credentials.json'));


describe('zoho-subscriptions', function () {

  describe('constructor', function () {

    it('should fail without an authtoken', function () {
      (function () {
        new ZohoSubscriptions({
          organization: '1234'
        });
      }).should.throw()
    });

    it('should fail without an organization', function () {
      (function () {
        new ZohoSubscriptions({
          authtoken: '<PASSWORD>'
        });
      }).should.throw()
    });

    it('should succeed with an authtoken and an organization', function () {
      (function () {
        new ZohoSubscriptions({
          authtoken: '<PASSWORD>',
          organization: '1234'
        });
      }).should.not.throw()
    });

    it('should succeed with a valid credentials.json', function () {
      (function () {
        new ZohoSubscriptions(credentials);
      }).should.not.throw()
    });

  });


  var testApi = new ZohoSubscriptions(credentials);

  var checkApiResponse = function (err, response, body) {
    assert.ifError(err);

    body.should.be.an('object');
    body.code.should.equal(0, 'bad api response code');
    body.message.should.equal('success');

    response.statusCode.should.satisfy(function (code) {
      console.log('code', code)
      return [200, 201].indexOf(code) !== -1;
    }, 'bad http status code');
  };


  describe('getOrganizations', function () {

    it('should return a list of organizations', function (done) {
      testApi.getOrganizations(function (err, response, body) {
        checkApiResponse(err, response, body);

        body.organizations.should.be.an('array');

        done();
      });
    });

  });

  describe('getProducts', function () {

    it('should return a list of products', function (done) {
      testApi.getProducts(function (err, response, body) {
        checkApiResponse(err, response, body);

        body.products.should.be.an('array');

        done();
      });
    });

  });

});
<commit_msg>Remove extra debug logging<commit_after>'use strict';

var chai = require('chai');
var should = chai.should();
var expect = chai.expect;
var assert = chai.assert;

var ZohoSubscriptions = require('../lib');

var credentials = JSON.parse(require('fs').readFileSync(__dirname + '/../credentials.json'));


describe('zoho-subscriptions', function () {

  describe('constructor', function () {

    it('should fail without an authtoken', function () {
      (function () {
        new ZohoSubscriptions({
          organization: '1234'
        });
      }).should.throw()
    });

    it('should fail without an organization', function () {
      (function () {
        new ZohoSubscriptions({
          authtoken: '<PASSWORD>'
        });
      }).should.throw()
    });

    it('should succeed with an authtoken and an organization', function () {
      (function () {
        new ZohoSubscriptions({
          authtoken: '<PASSWORD>',
          organization: '1234'
        });
      }).should.not.throw()
    });

    it('should succeed with a valid credentials.json', function () {
      (function () {
        new ZohoSubscriptions(credentials);
      }).should.not.throw()
    });

  });


  var testApi = new ZohoSubscriptions(credentials);

  var checkApiResponse = function (err, response, body) {
    assert.ifError(err);

    body.should.be.an('object');
    body.code.should.equal(0, 'bad api response code');
    body.message.should.equal('success');

    response.statusCode.should.satisfy(function (code) {
      return [200, 201].indexOf(code) !== -1;
    }, 'bad http status code');
  };


  describe('getOrganizations', function () {

    it('should return a list of organizations', function (done) {
      testApi.getOrganizations(function (err, response, body) {
        checkApiResponse(err, response, body);

        body.organizations.should.be.an('array');

        done();
      });
    });

  });

  describe('getProducts', function () {

    it('should return a list of products', function (done) {
      testApi.getProducts(function (err, response, body) {
        checkApiResponse(err, response, body);

        body.products.should.be.an('array');

        done();
      });
    });

  });

});

{'fraction_non_alphanumeric': 0.15818955859287476, 'fraction_numerical': 0.00717006497871387, 'mean_word_length': 2.7418273260687345, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5848252', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1255, 'n_words': 291}