adds npr one api test
This commit is contained in:
parent
b87aca566b
commit
f303313cda
1 changed files with 48 additions and 0 deletions
48
test/one.js
Normal file
48
test/one.js
Normal file
|
|
@ -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);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue