drip-nodejs
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -25,3 +25,3 @@ var Accounts = require('./accounts') | ||
"content-type": "application/vnd.api+json", | ||
"authorization": this.token, | ||
"authorization": "Basic " + new Buffer(this.token).toString('base64'), | ||
"User-Agent": "Drip NodeJS Wrapper" | ||
@@ -28,0 +28,0 @@ } |
{ | ||
"name": "drip-nodejs", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "A complete NodeJS wrapper for connecting to the Drip v2 REST API", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -6,11 +6,22 @@ 'use strict'; | ||
describe('Client', function () { | ||
it('should contain the correct headers', function () { | ||
var client = new Client({ token: 'abc123' }); | ||
expect(client.token).toEqual('abc123'); | ||
expect(client.headers).toEqual({ | ||
"content-type": "application/vnd.api+json", | ||
"authorization": 'abc123', | ||
"User-Agent": "Drip NodeJS Wrapper" | ||
}); | ||
var token = 'abc123'; | ||
it('should have token attribute', function () { | ||
var client = new Client({ token: token }); | ||
expect(client.token).toEqual(token); | ||
}); | ||
it('should add content-type header', function () { | ||
var client = new Client({ token: token }); | ||
expect(client.headers["content-type"]).toEqual("application/vnd.api+json"); | ||
}); | ||
it('should add basic auth authorization header', function () { | ||
var client = new Client({ token: token }); | ||
expect(client.headers.authorization).toEqual("Basic " + new Buffer(token).toString('base64')); | ||
}); | ||
it('should add user-agent header', function () { | ||
var client = new Client({ token: token }); | ||
expect(client.headers["User-Agent"]).toEqual("Drip NodeJS Wrapper"); | ||
}); | ||
}); |
67998
1519