From f303313cda0e12d91a566b5bd88afd951bcd9bd8 Mon Sep 17 00:00:00 2001 From: Todd Treece Date: Sat, 1 Aug 2015 20:06:33 -0400 Subject: [PATCH] adds npr one api test --- test/one.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/one.js diff --git a/test/one.js b/test/one.js new file mode 100644 index 0000000..81425e2 --- /dev/null +++ b/test/one.js @@ -0,0 +1,48 @@ +var NPR = require('../index'), + npr; + +process.env.NODE_ENV = 'test'; + +describe('NPR One', function() { + + this.timeout(10000); + + describe('Init', function() { + + it('should create a client', function(done) { + + npr = NPR({ + client_id: process.env.CLIENT_ID, + client_secret: process.env.CLIENT_SECRET, + username: process.env.NPR_USERNAME, + password: process.env.NPR_PASSWORD + }); + + npr.one.init() + .then(function() { done(); }) + .catch(done); + + }); + + }); + + describe('Authorization', function() { + + it('should get an access token', function(done) { + + npr.one.authorization + .createToken(npr.one.credentials) + .then(function(res) { + + if(! res.access_token) + done('missing token'); + + done(); + + }).catch(done); + + }); + + }); + +});