Skip to content

Commit

Permalink
fix: dummy commit webex-core
Browse files Browse the repository at this point in the history
  • Loading branch information
mkesavan13 committed Oct 9, 2023
1 parent ed675bb commit f0157ba
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/@webex/http-core/src/interceptors/http-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export default class HttpStatusInterceptor extends Interceptor {
// Note: the extra parenthesis below are required to make sure `new` is
// applied to the correct method (i.e., the result of `select()`, not
// `select()` itself).
/* eslint no-console: ["error", { allow: ["trace"] }] */
console.trace('===========');

return Promise.reject(new (this.ErrorConstructor.select(response.statusCode))(response));
}
}
2 changes: 2 additions & 0 deletions packages/@webex/webex-core/src/lib/services/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ const Services = WebexPlugin.extend({
break;
}

this.logger.info('================ updateServices API ================');

// confirm catalog update for group is not in progress.
if (catalog.status[serviceGroup].collecting) {
return this.waitForCatalog(serviceGroup);
Expand Down
2 changes: 2 additions & 0 deletions packages/@webex/webex-core/src/lib/webex-http-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default class WebexHttpError extends HttpError {
* @returns {string}
*/
parse(res) {
/* eslint no-console: ["error", { allow: ["trace"] }] */
console.trace('================ parse API ================');
let message = Reflect.apply(HttpError.prototype.parse, this, [res]);

Reflect.defineProperty(this, 'options', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('webex-core', () => {
},
},
});
sinon.stub(webex.boundedStorage, 'put');

assert.equal(webex.config.credentials.authorizeUrl, authorizeUrl);
});
Expand All @@ -46,6 +47,7 @@ describe('webex-core', () => {
webex = new WebexCore({
credentials: user.token,
});
sinon.stub(webex.boundedStorage, 'put');

credentials = webex.credentials;
});
Expand All @@ -65,6 +67,7 @@ describe('webex-core', () => {
webex = new WebexCore({
credentials: user.token,
});
sinon.stub(webex.boundedStorage, 'put');

credentials = webex.credentials;
});
Expand All @@ -85,6 +88,7 @@ describe('webex-core', () => {
webex = new WebexCore({
credentials: user.token,
});
sinon.stub(webex.boundedStorage, 'put');

credentials = webex.credentials;
});
Expand All @@ -102,6 +106,7 @@ describe('webex-core', () => {
const webex = new WebexCore({
credentials: user.token,
});
sinon.stub(webex.boundedStorage, 'put');

return webex.credentials.refresh().then(() => {
assert.isDefined(user.token.access_token);
Expand All @@ -114,6 +119,7 @@ describe('webex-core', () => {
const webex = new WebexCore({
credentials: user.token,
});
sinon.stub(webex.boundedStorage, 'put');

return assert.isRejected(webex.credentials.refresh());
});
Expand All @@ -127,6 +133,7 @@ describe('webex-core', () => {
},
},
});
sinon.stub(webex.boundedStorage, 'put');

return webex.credentials.refresh().then(() => {
assert.isDefined(user.token.access_token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('webex-core', () => {
describe('#downscope()', () => {
it('retrieves an access token with a subset of scopes', () => {
webex = new WebexCore({credentials: user.token});
sinon.stub(webex.boundedStorage, 'put');
const allScope = webex.credentials.config.scope;
const apiScope = filterScope('spark:kms', allScope);

Expand All @@ -46,6 +47,7 @@ describe('webex-core', () => {
describe('#refresh()', () => {
nodeOnly(it)('refreshes the token, returning a new Token instance', () => {
webex = new WebexCore({credentials: user.token});
sinon.stub(webex.boundedStorage, 'put');

return webex.credentials.supertoken.refresh().then((token2) => {
assert.notEqual(token2.access_token, webex.credentials.supertoken.access_token);
Expand All @@ -62,6 +64,7 @@ describe('webex-core', () => {
},
},
});
sinon.stub(webex.boundedStorage, 'put');

return webex.credentials.supertoken.refresh().then((token2) => {
assert.notEqual(token2.access_token, webex.credentials.supertoken.access_token);
Expand All @@ -73,6 +76,7 @@ describe('webex-core', () => {
describe('#validate()', () => {
it("shows the token's scopes", () => {
webex = new WebexCore({credentials: user.token});
sinon.stub(webex.boundedStorage, 'put');

return webex.credentials.supertoken.validate().then((details) => {
const detailScope = details.scope.sort();
Expand All @@ -89,6 +93,7 @@ describe('webex-core', () => {
describe('#revoke()', () => {
it('revokes the token', () => {
webex = new WebexCore({credentials: user.token});
sinon.stub(webex.boundedStorage, 'put');

return webex.credentials.supertoken.revoke().then(() => {
assert.isUndefined(webex.credentials.supertoken.access_token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('webex-core', () => {
setTimeout(() => {
webexUser = user;
webex = new WebexCore({credentials: user.token});
sinon.stub(webex.boundedStorage, 'put');
services = webex.internal.services;
catalog = services._getCatalog();
resolve();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ describe('webex-core', () => {
beforeEach('create webex instance', () => {
webex = new WebexCore({credentials: {supertoken: webexUser.token}});
webexEU = new WebexCore({credentials: {supertoken: webexUserEU.token}});
sinon.stub(webex.boundedStorage, 'put');
sinon.stub(webexEU.boundedStorage, 'put');
services = webex.internal.services;
servicesEU = webexEU.internal.services;
catalog = services._getCatalog();
Expand Down Expand Up @@ -397,6 +399,7 @@ describe('webex-core', () => {

it('should not attempt to collect catalogs without authorization', (done) => {
const otherWebex = new WebexCore();
sinon.stub(otherWebex.boundedStorage, 'put');
let {initServiceCatalogs} = otherWebex.internal.services;

initServiceCatalogs = sinon.stub();
Expand Down Expand Up @@ -802,6 +805,7 @@ describe('webex-core', () => {

describe('#validateUser()', () => {
const unauthWebex = new WebexCore();
sinon.stub(unauthWebex.boundedStorage, 'put');
const unauthServices = unauthWebex.internal.services;
let sandbox = null;

Expand Down Expand Up @@ -1104,6 +1108,7 @@ describe('webex-core', () => {

describe('#collectPreauthCatalog()', () => {
const unauthWebex = new WebexCore({config: {credentials: {federation: true}}});
sinon.stub(unauthWebex.boundedStorage, 'put');
const unauthServices = unauthWebex.internal.services;
const forceRefresh = true;

Expand Down Expand Up @@ -1158,6 +1163,7 @@ describe('webex-core', () => {

describe('#collectSigninCatalog()', () => {
const unauthWebex = new WebexCore({config: {credentials: {federation: true}}});
sinon.stub(unauthWebex.boundedStorage, 'put');
const unauthServices = unauthWebex.internal.services;

it('requires an email as the parameter', () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('webex-core', function () {

before(() => {
webex = new WebexCore();
sinon.stub(webex.boundedStorage, 'put');
});

it('adds a tracking id to each request', () =>
Expand Down Expand Up @@ -108,6 +109,7 @@ describe('webex-core', function () {

sinon.spy(webex.boundedStorage, 'clear');
sinon.spy(webex.unboundedStorage, 'clear');
sinon.stub(webex.boundedStorage, 'put');

return new Promise((resolve) => webex.once('ready', resolve)).then(() => {
const {supertoken} = webex.credentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import {assert} from '@webex/test-helper-chai';
import {capitalize} from 'lodash';
import WebexCore from '@webex/webex-core';
import sinon from 'sinon';

describe('webex-core', () => {
describe('Interceptors', () => {
Expand Down Expand Up @@ -113,6 +114,7 @@ describe('webex-core', () => {
},
},
});
sinon.stub(webex.boundedStorage, 'put');
});

describe('#transform()', () => {
Expand Down
8 changes: 8 additions & 0 deletions packages/@webex/webex-core/test/unit/spec/webex-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('Webex', () => {

beforeEach(() => {
webex = new WebexCore();
sinon.stub(webex.boundedStorage, 'put');
});

describe('#logger', () => {
Expand Down Expand Up @@ -60,6 +61,7 @@ describe('Webex', () => {

assert.doesNotThrow(() => {
webex = new WebexCore();
sinon.stub(webex.boundedStorage, 'put');
});
assert.isFalse(webex.canAuthorize);
assert.property(webex, 'credentials');
Expand Down Expand Up @@ -107,6 +109,7 @@ describe('Webex', () => {
.forEach(({msg, data}) => {
it(msg, () => {
const webex = new WebexCore(data);
sinon.stub(webex.boundedStorage, 'put');

assert.isTrue(webex.credentials.canAuthorize);
assert.equal(webex.credentials.supertoken.access_token, 'ST');
Expand Down Expand Up @@ -146,6 +149,7 @@ describe('Webex', () => {
access_token: token,
},
});
sinon.stub(webex.boundedStorage, 'put');

assert.isTrue(webex.credentials.canAuthorize);
assert.equal(webex.credentials.supertoken.access_token, '1234');
Expand All @@ -160,6 +164,7 @@ describe('Webex', () => {
const config = {credentials: {prop: true}};

const webex = new WebexCore();
sinon.stub(webex.boundedStorage, 'put');

assert.isUndefined(webex.config.credentials.prop);

Expand Down Expand Up @@ -189,6 +194,7 @@ describe('Webex', () => {
},
},
});
sinon.stub(webex.boundedStorage, 'put');

assert.isFalse(webex.loaded);
assert.isFalse(webex.canAuthorize);
Expand All @@ -204,6 +210,7 @@ describe('Webex', () => {

it('emits the ready event when the storage layer has loaded and all plugins signal ready', () => {
const webex = new WebexCore();
sinon.stub(webex.boundedStorage, 'put');

assert.isFalse(webex.ready);

Expand All @@ -228,6 +235,7 @@ describe('Webex', () => {
);

const webex = new WebexCore();
sinon.stub(webex.boundedStorage, 'put');

const changeSpy = sinon.spy();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('Webex', () => {
},
},
});
sinon.stub(webex.boundedStorage, 'put');

assert.isTrue(webex.internal.test.config.reachable);
webex.config.test.reachable = false;
Expand Down Expand Up @@ -52,6 +53,7 @@ describe('Webex', () => {
},
},
});
sinon.stub(webex.boundedStorage, 'put');

webex.internal.on('all', (ev) =>
console.info(
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/jest/static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ module.exports = {
reporters: ['default'],
testMatch: ['<rootDir>/test/unit/**/!(lib|fixture)/*.[jt]s'],
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
detectOpenHandles: true,
};

0 comments on commit f0157ba

Please sign in to comment.