diff --git a/lib/endpoints/search.js b/lib/endpoints/search.js index 23b8ac9..8a6b548 100755 --- a/lib/endpoints/search.js +++ b/lib/endpoints/search.js @@ -15,10 +15,10 @@ Search.prototype.beers = function(route, params, callback) { this.executeRequest(`${this.genEndpoint}${route ? `/${route}` : ``}`, params, callback); } -Search.prototype.breweries = function(params, callback) { +Search.prototype.breweries = function(route, params, callback) { params.key = this.config.key; params.type = "brewery"; - this.executeRequest(this.genEndpoint, params, callback); + this.executeRequest(`${this.genEndpoint}${route ? `/${route}` : ``}`, params, callback); } Search.prototype.guilds = function(params, callback) { diff --git a/test/endpoints/search.js b/test/endpoints/search.js index db00d03..0e4a96f 100755 --- a/test/endpoints/search.js +++ b/test/endpoints/search.js @@ -25,13 +25,19 @@ describe('Search', function() { }); describe("beers()", function() { it("should have a type param set to 'beer'", function() { - search.beers({ q: "Coors" }, null); + search.beers("", { q: "Coors" }, null); stub.calledWith("search", { key: "abc123", q: "Coors", type: "beer"}); }); }); describe("breweries()", function() { it("should have a type param set to 'brewery'", function() { - search.breweries({ q: "Coors" }, null); + search.breweries("", { q: "Coors" }, null); + stub.calledWith("search", { key: "abc123", q: "Coors", type: "brewery"}); + }); + }); + describe("breweries()", function() { + it("should accept an optional route", function() { + search.breweries("/search/geo/point", { q: "Coors" }, null); stub.calledWith("search", { key: "abc123", q: "Coors", type: "brewery"}); }); }); @@ -49,4 +55,3 @@ describe('Search', function() { }); }); }); -