From 45c04803fecceac3b54da1588c47698693efba0a Mon Sep 17 00:00:00 2001 From: Todd Treece Date: Sat, 1 Aug 2015 23:25:27 -0400 Subject: [PATCH] adds listening tests --- test/one.js | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/test/one.js b/test/one.js index 81425e2..47a0745 100644 --- a/test/one.js +++ b/test/one.js @@ -28,14 +28,78 @@ describe('NPR One', function() { describe('Authorization', function() { - it('should get an access token', function(done) { + it('should get an access token using password grant type', function(done) { npr.one.authorization .createToken(npr.one.credentials) .then(function(res) { if(! res.access_token) - done('missing token'); + done('missing access token'); + + done(); + + }).catch(done); + + }); + + }); + + describe('Listening', function() { + + it('should get channels', function(done) { + + npr.one.listening + .getChannels() + .then(function(res) { + + if(! res.items.length) + done('missing channels'); + + done(); + + }).catch(done); + + }); + + it('should get history', function(done) { + + npr.one.listening + .getHistory() + .then(function(res) { + + if(! res.items.length) + done('missing history'); + + done(); + + }).catch(done); + + }); + + it('should get recommendations', function(done) { + + npr.one.listening + .getRecommendations({channel: 'npr'}) + .then(function(res) { + + if(! res.items.length) + done('missing recommendations'); + + done(); + + }).catch(done); + + }); + + it('should get search recommendations', function(done) { + + npr.one.listening + .getSearchRecommendations({searchTerms: 'dog'}) + .then(function(res) { + + if(! res.items.length) + done('missing search recommendations'); done();