forked from vpulim/node-soap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BearerSecurity.js
31 lines (26 loc) · 914 Bytes
/
BearerSecurity.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
describe('BearerSecurity', function() {
var BearerSecurity = require('../../').BearerSecurity;
var token = "token";
it('is a function', function() {
BearerSecurity.should.be.type('function');
});
describe('defaultOption param', function() {
it('is accepted as the second param', function() {
new BearerSecurity(token, {});
});
it('is used in addOptions', function() {
var options = {};
var defaultOptions = { foo: 2 };
var instance = new BearerSecurity(token, defaultOptions);
instance.addOptions(options);
options.should.have.property("foo", 2);
});
it('should return the authoriation header on calling addHeader', () => {
const security = new BearerSecurity(token, {});
let headers = {};
security.addHeaders(headers);
headers.should.have.property('Authorization', "Bearer token");
});
});
});