Skip to content

Commit

Permalink
adds output stats test
Browse files Browse the repository at this point in the history
  • Loading branch information
toddtreece committed Jun 11, 2014
1 parent 8e40ad1 commit 1fc354f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/http_output.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ app.stats = function(req, res) {

var self = this,
error = this.error.bind(this, req, res),
pub = req.query.publicKey,
pub = req.publicKey,
id;

// check for public key
Expand Down
24 changes: 23 additions & 1 deletion test/http_output_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,29 @@ exports.output = {

});

}
},

'stats': function(test) {

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

test.expect(4);

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

body = JSON.parse(body.trim());

test.ok(!error, 'should not error');
test.ok(response.headers['content-type'].match('^application/json'), 'content-type should be application/json');
test.equal(response.statusCode, 200, 'status should be 200');
test.equal(body.cap, 4000, 'cap should be 4000');

test.done();

});

},

};

Expand Down

0 comments on commit 1fc354f

Please sign in to comment.