Skip to content

Instantly share code, notes, and snippets.

@aepyornis
Created January 15, 2015 22:33
Show Gist options
  • Save aepyornis/01d8124586e54647aa8c to your computer and use it in GitHub Desktop.
Save aepyornis/01d8124586e54647aa8c to your computer and use it in GitHub Desktop.
writeCSV-test-mocha
var fs = require('fs');
var should = require('should');
var util = require('../util');
// var db = mongojs('mongodb://localhost:27017/test', ['jobs']);
describe('writeCSV', function(){
this.timeout(20000);
before(function(done){
util.writeCSV(['BuildingType', 'ExistingStories', 'OwnerName'], 'test3', {'CB': '304'}, function(){
done();
});
})
it('works on three variables', function(){
var test_csv = fs.readFileSync('test3.csv').toString();
var lines = test_csv.split(/\n/);
lines[0].should.eql('BuildingType,ExistingStories,OwnerName');
var lineLength = lines[1].split(',').length;
lineLength.should.eql(3);
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment