@monokle/synchronizer
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -99,2 +99,5 @@ "use strict"; | ||
this._apiUrl = _apiUrl; | ||
if ((_apiUrl || '').length === 0) { | ||
this._apiUrl = constants_js_1.DEFAULT_API_URL; | ||
} | ||
} | ||
@@ -101,0 +104,0 @@ get apiUrl() { |
@@ -9,2 +9,3 @@ export * from './handlers/apiHandler.js'; | ||
export * from './utils/authenticator.js'; | ||
export * from './utils/fetcher.js'; | ||
export * from './utils/synchronizer.js'; | ||
@@ -11,0 +12,0 @@ export * from './constants.js'; |
@@ -25,2 +25,3 @@ "use strict"; | ||
__exportStar(require("./utils/authenticator.js"), exports); | ||
__exportStar(require("./utils/fetcher.js"), exports); | ||
__exportStar(require("./utils/synchronizer.js"), exports); | ||
@@ -27,0 +28,0 @@ __exportStar(require("./constants.js"), exports); |
@@ -6,4 +6,4 @@ import { assert } from 'chai'; | ||
it('formats header correctly (bearer)', async () => { | ||
const synchronizer = new ApiHandler(); | ||
const header = synchronizer.formatAuthorizationHeader({ | ||
const apiHandler = new ApiHandler(); | ||
const header = apiHandler.formatAuthorizationHeader({ | ||
accessToken: 'SAMPLE_TOKEN', | ||
@@ -15,4 +15,4 @@ tokenType: 'Bearer', | ||
it('formats header correctly (apikey)', async () => { | ||
const synchronizer = new ApiHandler(); | ||
const header = synchronizer.formatAuthorizationHeader({ | ||
const apiHandler = new ApiHandler(); | ||
const header = apiHandler.formatAuthorizationHeader({ | ||
accessToken: 'SAMPLE_TOKEN', | ||
@@ -24,4 +24,4 @@ tokenType: 'ApiKey', | ||
it('formats header correctly (invalid)', async () => { | ||
const synchronizer = new ApiHandler(); | ||
const header = synchronizer.formatAuthorizationHeader({ | ||
const apiHandler = new ApiHandler(); | ||
const header = apiHandler.formatAuthorizationHeader({ | ||
accessToken: 'SAMPLE_TOKEN', | ||
@@ -33,4 +33,4 @@ tokenType: 'invalid', | ||
it('formats header correctly (not set)', async () => { | ||
const synchronizer = new ApiHandler(); | ||
const header = synchronizer.formatAuthorizationHeader({ | ||
const apiHandler = new ApiHandler(); | ||
const header = apiHandler.formatAuthorizationHeader({ | ||
accessToken: 'SAMPLE_TOKEN', | ||
@@ -42,2 +42,20 @@ tokenType: undefined, | ||
}); | ||
describe('Api Url', () => { | ||
it('uses default Api Url by default', async () => { | ||
assert.equal('https://api.monokle.com', (new ApiHandler()).apiUrl); | ||
}); | ||
it('uses default Api Url when falsy value passed', async () => { | ||
assert.equal('https://api.monokle.com', (new ApiHandler('')).apiUrl); | ||
assert.equal('https://api.monokle.com', (new ApiHandler(false)).apiUrl); | ||
assert.equal('https://api.monokle.com', (new ApiHandler(null)).apiUrl); | ||
assert.equal('https://api.monokle.com', (new ApiHandler(undefined)).apiUrl); | ||
assert.equal('https://api.monokle.com', (new ApiHandler(0)).apiUrl); | ||
}); | ||
it('uses passed Api Url', async () => { | ||
assert.equal('https://dev.api.monokle.com', (new ApiHandler('https://dev.api.monokle.com')).apiUrl); | ||
assert.equal('https://api.monokle.io', (new ApiHandler('https://api.monokle.io')).apiUrl); | ||
assert.equal('http://localhost:5000', (new ApiHandler('http://localhost:5000')).apiUrl); | ||
assert.equal('http://localhost', (new ApiHandler('http://localhost:80')).apiUrl); | ||
}); | ||
}); | ||
}); |
@@ -85,2 +85,5 @@ import normalizeUrl from 'normalize-url'; | ||
this._apiUrl = _apiUrl; | ||
if ((_apiUrl || '').length === 0) { | ||
this._apiUrl = DEFAULT_API_URL; | ||
} | ||
} | ||
@@ -87,0 +90,0 @@ get apiUrl() { |
@@ -9,2 +9,3 @@ export * from './handlers/apiHandler.js'; | ||
export * from './utils/authenticator.js'; | ||
export * from './utils/fetcher.js'; | ||
export * from './utils/synchronizer.js'; | ||
@@ -11,0 +12,0 @@ export * from './constants.js'; |
@@ -9,2 +9,3 @@ export * from './handlers/apiHandler.js'; | ||
export * from './utils/authenticator.js'; | ||
export * from './utils/fetcher.js'; | ||
export * from './utils/synchronizer.js'; | ||
@@ -11,0 +12,0 @@ export * from './constants.js'; |
{ | ||
"name": "@monokle/synchronizer", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "Monokle Cloud synchronizer", | ||
@@ -5,0 +5,0 @@ "author": "Kubeshop", |
165349
3694