<commit_before>var should = require('should')
  , conf = require("../index.js")
  , h = require("../lib/helper.js");


describe('Helper', function(){
  it('getfiles', function(done){
    h.getFiles(["samples/ip*.json", "samples/city.json"], true, false, function(data){
      console.log(data);//3 helpers
      console.log("==>", data.get(0, 'city'));
      console.log("==>", data.get(5, 'city'));
      done();
    });
  });

  it('getfiles', function(done){
    h.getFiles(["samples/col*.json", "samples/city.json"], false, false, function(data){
      console.log("==>", data);
      done();
    });
  });
});

describe('get', function(){
  it('get all json and merge it', function(done){
     conf.get({merge: true, path: ["samples/*.json"]})
      .exec(function (err, data) {
        console.log("==>", data);
        done()
      });
  });

  it("get all json and don't merge", function(done){
     conf.get({path: ["samples/*.json"]})
      .exec(function (err, data) {
        console.log("==>", data.get('country', 24));
        done()
      });
  });
});

describe('multiple', function(){
  it('multiple config merge and not merge with keyname', function(done){
     conf.multiple({
      schema: [
        {
          merge: true,
          name:'conf1',
          path: ["samples/*.json"]
        }, {
          merge: false,
          name:'conf2',
          path: ["samples/*.json"]
        }
      ]
     }).exec(function (err, data) {
      console.log("==>", data.get('conf1', 'path'));
      done()
     });
  });
});


describe('load', function(){
  it('load simple get config', function(done){
     conf.load({path: 'samples/load-test-simple.json'}).exec(function (err, data) {
      console.log("==>", data.get('merge'));
      done()
     });
  });
  it('load multiple config', function(done){
     conf.load({path: 'samples/load-test.json'}).exec(function (err, data) {
      console.log(data);
      // console.log(data.get('color'));
      console.log("==>", data.get('color', '1'));
      console.log("==>", data.get('color', '1', 'hexcolor'));
      done()
     });
  });
});
<commit_msg>better test<commit_after>var should = require('should')
  , conf = require("../index.js")
  , h = require("../lib/helper.js");


describe('Helper', function(){
  it('getfiles', function(done){
    h.getFiles(["samples/ip*.json", "samples/city.json"], true, false, function(data){
      console.log("3 helpers: ", data);
      // console.log("==>", data.get(0, 'city'));
      // console.log("==>", data.get(5, 'city'));
      should(data).be.type('object');
      should(data).not.be.type('string');
      should( data.get(0, 'city') ).be.equal('Nartkala');
      done();
    });
  });

  it('getfiles', function(done){
    h.getFiles(["samples/col*.json", "samples/city.json"], false, false, function(data){
      // console.log("==>", data.get('city',50));
      should (data.get('city',50, 'id')).be.equal(51)
      should (data.get('city',50, 'id')).not.be.equal('51')
      done();
    });
  });
});

describe('get', function(){
  it('get all json and merge it', function(done){
     conf.get({merge: true, path: ["samples/*.json"]})
      .exec(function (err, data) {
        // console.log("==>", data.get(25,'job'));
        should( data.get(25, 'job') ).be.equal('Mechanical Systems Engineer');
        done()
      });
  });

  it("get all json and don't merge", function(done){
     conf.get({path: ["samples/*.json"]})
      .exec(function (err, data) {
        // console.log("==>", data.get('country', 24));
        should( data.get('country', 24) ).be.type('object');
        should( data.get('country', 24, 'code') ).be.equal('SE');
        done()
      });
  });
});

describe('multiple', function(){
  it('multiple config merge and not merge with keyname', function(done){
     conf.multiple({
      schema: [
        {
          merge: true,
          name:'conf1',
          path: ["samples/*.json"]
        }, {
          merge: false,
          name:'conf2',
          path: ["samples/*.json"]
        }
      ]
     }).exec(function (err, data) {
      // console.log("==>", data.get('conf1', 'path'));
      should( data.get('conf1', 'path') ).be.type('object');
      should( data.get('conf1', 'path')[0] ).be.equal('samples/*.json');

      done()
     });
  });
});


describe('load', function(){
  it('load simple get config', function(done){
     conf.load({path: 'samples/load-test-simple.json'}).exec(function (err, data) {
      // console.log("==>", data.get('merge'));
      should( data.get('merge') ).be.type('boolean');
      should( data.get('merge') ).be.equal(true);
      done()
     });
  });
  it('load multiple config', function(done){
     conf.load({path: 'samples/load-test.json'}).exec(function (err, data) {
      // console.log(data);
      // console.log(data.get('color'));
      // console.log("==>", data.get('color', '1'));
      // console.log("==>", data.get('color', '1', 'hexcolor'));
      should( data.get('color', 1) ).be.type('object');
      should( data.get('color', 1, 'hexcolor') ).be.equal('#186');
      done()
     });
  });
});

{'fraction_non_alphanumeric': 0.24428376001563415, 'fraction_numerical': 0.009185069376587845, 'mean_word_length': 2.7221818181818183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '7506147', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1659, 'n_words': 316}