Skip to content

Commit

Permalink
none operator unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed Nov 29, 2013
1 parent 4abc1fd commit 8a1055d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/unit.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// require('./unit/csv.js');
// require('./unit/incsv.js');
// require('./unit/outcsv.js');
require('./unit/cut.js');
// require('./unit/delete.js');
// require('./unit/grep.js');
// require('./unit/head.js');
// require('./unit/html.js');
// require('./unit/none.js');
// require('./unit/outhtml.js');
require('./unit/none.js');
// require('./unit/replace.js');
require('./unit/strip.js');
// require('./unit/tail.js');
36 changes: 36 additions & 0 deletions test/unit/none.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var assert = require('assert');
var csv = require('csv');
var stream = require('stream');
var _ = require('underscore');

var ops = require('../../lib/operators.js');

var headerStr = 'this,is,the,header,row,,,,,,,,,,,,,,,,';
var headerRow = headerStr.split(',');
var headerData = JSON.stringify({row: headerRow, index: 0});

var out = new stream();

describe('none', function(){
var dataStr = '2006/2007 - 12,81.2,163.0,244.2,77.4,143.4,220.5,5.4%,7.6%,6.8%,4.6%,4.4%,4.5%,,,,,,,,';
var row = dataStr.split(',');
var data = JSON.stringify({row: row, index: 1});

it('should pass everything through untouched', function(done){
rowCount = 0;
out.write = function(d) {
rowCount++;
};

out.end = function(d) {
assert.equal(rowCount, 2);
done();
};

var none = new ops['none']();
none.write(headerData);
none.write(data);
none.end();
none.pipe(out);
});
});

1 comment on commit 8a1055d

@andylolz
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refs #95

Please sign in to comment.