Skip to content

Commit

Permalink
adds output field test
Browse files Browse the repository at this point in the history
  • Loading branch information
toddtreece committed Aug 19, 2014
1 parent b1b67d7 commit c77a9a3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/limit_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ app._flush = function(callback) {
app.write = function(chunk, encoding, cb) {

if (this.count >= this.limit) {
console.log('done');
this.end();
return false;
}
Expand Down
27 changes: 27 additions & 0 deletions test/http_output_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,33 @@ exports.output = {

},

'field': function(test) {

var url = 'http://localhost:' + http_port + '/output/' +
keys.publicKey(test_stream.id) + '/test1';

test.expect(6);

request(url, function(error, response, body) {

body = body.split('\n');

test.ok(!error, 'should not error');

test.ok(response.headers['content-type'].match('^text/plain'), 'content-type should be text/plain');

test.equal(response.statusCode, 200, 'status should be 200');

test.equal(body[0], '199', 'first line should be 199');
test.equal(body[1], '198', 'second line should be 198');
test.equal(body[2], '197', 'third line should be 197');

test.done();

});

},

'latest row': function(test) {

var url = 'http://localhost:' + http_port + '/output/' +
Expand Down

0 comments on commit c77a9a3

Please sign in to comment.