From 78c324f27990f231d34ca177937035bb91ab59a9 Mon Sep 17 00:00:00 2001 From: Erin E Commarato Date: Fri, 11 Aug 2017 15:58:32 -0400 Subject: [PATCH] Updates to add geo search capabilities and added to test lib --- lib/endpoints/search.js | 4 ++-- test/endpoints/search.js | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) 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() { }); }); }); -