Skip to content

Commit

Permalink
adds output jsonp test
Browse files Browse the repository at this point in the history
  • Loading branch information
toddtreece committed Jun 11, 2014
1 parent 20eea13 commit c434c37
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/http_output_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,35 @@ exports.output = {

},

'jsonp': function(test) {

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

test.expect(4);

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

var phant_jsonp_test = function(obj) {
return obj;
};

var result = eval(body); // jshint ignore:line

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

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

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

test.equal(result[0].test1, '199', 'first element should be 199');

test.done();

});

},

'csv': function(test) {

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

0 comments on commit c434c37

Please sign in to comment.