Adding test for failure, removing spurious debugger statement.
This commit is contained in:
parent
ef9fa5de91
commit
93617dec23
2 changed files with 14 additions and 1 deletions
|
@ -51,7 +51,6 @@ var Bing = function( options ) {
|
|||
opts = _.extend(this.options, options);
|
||||
}
|
||||
|
||||
debugger;
|
||||
var reqUri = opts.rootUri + vertical +
|
||||
"?$format=json&" +
|
||||
qs.stringify({ "Query": "'" + query + "'" });
|
||||
|
|
14
test/test.js
14
test/test.js
|
@ -70,4 +70,18 @@ describe('Bing', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should cope with errors', function(done) {
|
||||
// No actual data on what the failure looks like.
|
||||
var failure = { message: 'Failed request' };
|
||||
app.get('/hello/Image', function (req, res) {
|
||||
res.status(500).send(JSON.stringify(failure));
|
||||
});
|
||||
var bingClient = bing({ rootUri: 'http://localhost:'+port+'/hello/', accKey: '123' });
|
||||
bingClient.images('xbox', function (error, response, body) {
|
||||
response.statusCode.should.eql(500);
|
||||
body.should.eql(failure);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue