Skip to content

Commit c141f42

Browse files
committed
fix: oauth unit test cases
1 parent 6fa265a commit c141f42

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

lib/core/contentstackHTTPClient.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ export default function contentstackHttpClient (options) {
6868
let uiHostName = hostname
6969
let developerHubBaseUrl = hostname
7070

71-
if (hostname.endsWith('io')) {
72-
uiHostName = hostname.replace('io', 'com')
71+
if (uiHostName?.endsWith('io')) {
72+
uiHostName = uiHostName.replace('io', 'com')
7373
}
7474

75-
if (hostname.startsWith('api')) {
75+
if (uiHostName?.startsWith('api')) {
7676
uiHostName = uiHostName.replace('api', 'app')
7777
}
7878
const uiBaseUrl = config.endpoint || `${protocol}://${uiHostName}`

test/unit/ContentstackHTTPClient-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('Contentstack HTTP Client', () => {
112112

113113
it('Contentstack retryDelayOption base test', done => {
114114
const client = contentstackHTTPClient({
115-
retryDelayOptions: { base: 200 }
115+
retryDelayOptions: { base: 200 },
116116
})
117117
expect(client.defaults.retryDelayOptions).to.not.equal(undefined)
118118
expect(client.defaults.retryDelayOptions.base).to.be.equal(200)

test/unit/oauthHandler-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ describe('OAuthHandler', () => {
5959

6060
const result = await oauthHandler.exchangeCodeForToken('authorization_code')
6161
expect(result).to.deep.equal(tokenData)
62-
expect(result).to.include('data')
6362
})
6463

6564
it('should refresh access token', async () => {

0 commit comments

Comments
 (0)