diff --git a/lib/bing.js b/lib/bing.js index 55a21c8..0eb5420 100644 --- a/lib/bing.js +++ b/lib/bing.js @@ -77,7 +77,9 @@ var Bing = function (options) { + "&$top=" + opts.top + "&$skip=" + opts.skip + "&Options=%27" + (opts.options || []).join('%2B') + "%27" - + (opts.sources ? "&Sources=%27" + opts.sources + "%27" : '') + + (opts.sources + ? "&Sources=%27" + encodeURIComponent(opts.sources) + "%27" + : '') + (opts.newsSortBy ? "&NewsSortBy=%27" + opts.newsSortBy + "%27" : '') + (opts.newsCategory ? "&NewsCategory=%27" + opts.newsCategory + "%27" : '') + (opts.newsLocationOverride diff --git a/test/integration.js b/test/integration.js index 46d8e50..7e75ca4 100644 --- a/test/integration.js +++ b/test/integration.js @@ -136,6 +136,35 @@ describe("Bing News", function () { }); +describe("Bing Composite", function () { + + this.timeout(1000 * 10); + + it('finds composite search', function (done) { + + Bing.composite('animal', + { + sources: 'web+news', + skip: 1, + newSortBy: 'Date' + }, + function (err, res, body) { + + //TODO try unaccepted options like imageFilters + + should.not.exist(err); + should.exist(res); + should.exist(body); + + body.d.results.should.have.length(1); + + done(); + }); + }); + +}); + + describe("Bing Video", function () { this.timeout(1000 * 10);