<commit_before>/* jshint node:true */
/* jshint esversion: 6 */
/* jshint -W030 */

var chai = require('chai');
var expect = chai.expect;
var jsonexport = require('../lib/index');
var os = require('os');


const isRemoteTest = process.env.APPVEYOR || process.env.TRAVIS
if( isRemoteTest ){
  console.log('\x1b[34mRemote testing server detected. INFO:'+os.type()+' '+os.platform()+'\x1b[0m')
}

describe('Object', () => {
  it('simple', () => {
    jsonexport({
      lang: 'Node.js',
      module: 'jsonexport'
    }, {}, (err, csv) => {
      expect(csv).to.equal(`lang,Node.js${os.EOL}module,jsonexport`);
    });
  });

  it('complex', () => {
    jsonexport({
      cars: 12,
      roads: 5,
      traffic: 'slow',
      speed: {
        max: 123,
        avg: 20,
        min: 5
      },
      size: [10, 20],
      escaped: 'I am a "quoted" field'
    }, {}, (err, csv) => {
      expect(csv).to.equal(`cars,12${os.EOL}roads,5${os.EOL}traffic,slow${os.EOL}speed.max,123${os.EOL}speed.avg,20${os.EOL}speed.min,5${os.EOL}size,10;20${os.EOL}escaped,"I am a ""quoted"" field"`);
    });
  });

  it('Github Issue #41 p1',()=>{
    var contacts = [{
        name: 'Bob',
        lastname: 'Smith',
        status: null,
        test: true
    },{
        name: 'James',
        lastname: 'David',
        status: 'fired',
        test: true
    }];

    jsonexport(contacts, (err, csv)=>{
      expect(csv).to.equal(`name,lastname,status,test${os.EOL}Bob,Smith,,true${os.EOL}James,David,fired,true`);
    });
  });

  it('Github Issue #41 p2',()=>{
    var contacts = {
      'a' : 'another field',
      'b' : '',
      'c' : 'other field'
    };

    jsonexport(contacts, (err, csv)=>{
      expect(csv).to.equal(`a,another field${os.EOL}b,${os.EOL}c,other field`);
    });
  });
});<commit_msg>release os name in cli test detection<commit_after>/* jshint node:true */
/* jshint esversion: 6 */
/* jshint -W030 */

var chai = require('chai');
var expect = chai.expect;
var jsonexport = require('../lib/index');
var os = require('os');


const isRemoteTest = process.env.APPVEYOR || process.env.TRAVIS
if( isRemoteTest ){
  console.log('\x1b[34mRemote testing server detected on '+os.type()+' '+os.platform()+' '+os.release()+'\x1b[0m')
}

describe('Object', () => {
  it('simple', () => {
    jsonexport({
      lang: 'Node.js',
      module: 'jsonexport'
    }, {}, (err, csv) => {
      expect(csv).to.equal(`lang,Node.js${os.EOL}module,jsonexport`);
    });
  });

  it('complex', () => {
    jsonexport({
      cars: 12,
      roads: 5,
      traffic: 'slow',
      speed: {
        max: 123,
        avg: 20,
        min: 5
      },
      size: [10, 20],
      escaped: 'I am a "quoted" field'
    }, {}, (err, csv) => {
      expect(csv).to.equal(`cars,12${os.EOL}roads,5${os.EOL}traffic,slow${os.EOL}speed.max,123${os.EOL}speed.avg,20${os.EOL}speed.min,5${os.EOL}size,10;20${os.EOL}escaped,"I am a ""quoted"" field"`);
    });
  });

  it('Github Issue #41 p1',()=>{
    var contacts = [{
        name: 'Bob',
        lastname: 'Smith',
        status: null,
        test: true
    },{
        name: 'James',
        lastname: 'David',
        status: 'fired',
        test: true
    }];

    jsonexport(contacts, (err, csv)=>{
      expect(csv).to.equal(`name,lastname,status,test${os.EOL}Bob,Smith,,true${os.EOL}James,David,fired,true`);
    });
  });

  it('Github Issue #41 p2',()=>{
    var contacts = {
      'a' : 'another field',
      'b' : '',
      'c' : 'other field'
    };

    jsonexport(contacts, (err, csv)=>{
      expect(csv).to.equal(`a,another field${os.EOL}b,${os.EOL}c,other field`);
    });
  });
});
{'fraction_non_alphanumeric': 0.2220693450742983, 'fraction_numerical': 0.022564667033571822, 'mean_word_length': 2.6978636826042726, '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': '2682084', 'n_tokens_mistral': 1496, 'n_tokens_neox': 1400, 'n_words': 244}