Skip to content

Commit b15c691

Browse files
committed
add tests
1 parent b0d4c00 commit b15c691

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/unit/test.base_service.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,17 @@ describe('BaseService', function() {
124124
};
125125
assert.deepEqual(actual, expected);
126126
});
127+
128+
it('should set header with access_token parameter', function() {
129+
const token = 'abc-1234';
130+
const instance = new TestService({ access_token: token });
131+
assert.equal(instance._options.headers['Authorization'], `Bearer ${token}`);
132+
});
133+
134+
it('should update header with setAccessToken', function() {
135+
const instance = new TestService({ access_token: 'abc-1234' });
136+
const newToken = 'zyx-9876';
137+
instance.setAccessToken(newToken);
138+
assert.equal(instance._options.headers['Authorization'], `Bearer ${newToken}`);
139+
});
127140
});

0 commit comments

Comments
 (0)