diff --git a/packages/@webex/webex-core/test/integration/spec/credentials/credentials.js b/packages/@webex/webex-core/test/integration/spec/credentials/credentials.js index 05916b4c54a..64c7c6779b1 100644 --- a/packages/@webex/webex-core/test/integration/spec/credentials/credentials.js +++ b/packages/@webex/webex-core/test/integration/spec/credentials/credentials.js @@ -33,6 +33,7 @@ describe('webex-core', () => { }, }, }); + sinon.stub(webex.boundedStorage, 'put'); assert.equal(webex.config.credentials.authorizeUrl, authorizeUrl); }); @@ -46,6 +47,7 @@ describe('webex-core', () => { webex = new WebexCore({ credentials: user.token, }); + sinon.stub(webex.boundedStorage, 'put'); credentials = webex.credentials; }); @@ -65,6 +67,7 @@ describe('webex-core', () => { webex = new WebexCore({ credentials: user.token, }); + sinon.stub(webex.boundedStorage, 'put'); credentials = webex.credentials; }); @@ -85,6 +88,7 @@ describe('webex-core', () => { webex = new WebexCore({ credentials: user.token, }); + sinon.stub(webex.boundedStorage, 'put'); credentials = webex.credentials; }); @@ -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); @@ -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()); }); @@ -127,6 +133,7 @@ describe('webex-core', () => { }, }, }); + sinon.stub(webex.boundedStorage, 'put'); return webex.credentials.refresh().then(() => { assert.isDefined(user.token.access_token); diff --git a/packages/@webex/webex-core/test/integration/spec/credentials/token.js b/packages/@webex/webex-core/test/integration/spec/credentials/token.js index 54123b8507c..e70359312e6 100644 --- a/packages/@webex/webex-core/test/integration/spec/credentials/token.js +++ b/packages/@webex/webex-core/test/integration/spec/credentials/token.js @@ -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); @@ -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); @@ -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); @@ -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(); @@ -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); diff --git a/packages/@webex/webex-core/test/integration/spec/services/service-catalog.js b/packages/@webex/webex-core/test/integration/spec/services/service-catalog.js index fd6bce9cb4a..5a405779354 100644 --- a/packages/@webex/webex-core/test/integration/spec/services/service-catalog.js +++ b/packages/@webex/webex-core/test/integration/spec/services/service-catalog.js @@ -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(); diff --git a/packages/@webex/webex-core/test/integration/spec/services/services.js b/packages/@webex/webex-core/test/integration/spec/services/services.js index 1e653d8fe52..58081b6fe03 100644 --- a/packages/@webex/webex-core/test/integration/spec/services/services.js +++ b/packages/@webex/webex-core/test/integration/spec/services/services.js @@ -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(); @@ -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(); @@ -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; @@ -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; @@ -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', () => diff --git a/packages/@webex/webex-core/test/integration/spec/webex-core.js b/packages/@webex/webex-core/test/integration/spec/webex-core.js index fe53651b10b..c3b9b6f2608 100644 --- a/packages/@webex/webex-core/test/integration/spec/webex-core.js +++ b/packages/@webex/webex-core/test/integration/spec/webex-core.js @@ -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', () => @@ -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; diff --git a/packages/@webex/webex-core/test/unit/spec/interceptors/payload-transformer.js b/packages/@webex/webex-core/test/unit/spec/interceptors/payload-transformer.js index 04008ced85f..dc1b71c9b59 100644 --- a/packages/@webex/webex-core/test/unit/spec/interceptors/payload-transformer.js +++ b/packages/@webex/webex-core/test/unit/spec/interceptors/payload-transformer.js @@ -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', () => { @@ -113,6 +114,7 @@ describe('webex-core', () => { }, }, }); + sinon.stub(webex.boundedStorage, 'put'); }); describe('#transform()', () => { diff --git a/packages/@webex/webex-core/test/unit/spec/webex-core.js b/packages/@webex/webex-core/test/unit/spec/webex-core.js index be0f5681667..3053d3cc380 100644 --- a/packages/@webex/webex-core/test/unit/spec/webex-core.js +++ b/packages/@webex/webex-core/test/unit/spec/webex-core.js @@ -13,6 +13,7 @@ describe('Webex', () => { beforeEach(() => { webex = new WebexCore(); + sinon.stub(webex.boundedStorage, 'put'); }); describe('#logger', () => { @@ -60,6 +61,7 @@ describe('Webex', () => { assert.doesNotThrow(() => { webex = new WebexCore(); + sinon.stub(webex.boundedStorage, 'put'); }); assert.isFalse(webex.canAuthorize); assert.property(webex, 'credentials'); @@ -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'); @@ -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'); @@ -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); @@ -189,6 +194,7 @@ describe('Webex', () => { }, }, }); + sinon.stub(webex.boundedStorage, 'put'); assert.isFalse(webex.loaded); assert.isFalse(webex.canAuthorize); @@ -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); @@ -228,6 +235,7 @@ describe('Webex', () => { ); const webex = new WebexCore(); + sinon.stub(webex.boundedStorage, 'put'); const changeSpy = sinon.spy(); diff --git a/packages/@webex/webex-core/test/unit/spec/webex-internal-core.js b/packages/@webex/webex-core/test/unit/spec/webex-internal-core.js index 5e3d5945b53..03756cb534d 100644 --- a/packages/@webex/webex-core/test/unit/spec/webex-internal-core.js +++ b/packages/@webex/webex-core/test/unit/spec/webex-internal-core.js @@ -24,6 +24,7 @@ describe('Webex', () => { }, }, }); + sinon.stub(webex.boundedStorage, 'put'); assert.isTrue(webex.internal.test.config.reachable); webex.config.test.reachable = false; @@ -52,6 +53,7 @@ describe('Webex', () => { }, }, }); + sinon.stub(webex.boundedStorage, 'put'); webex.internal.on('all', (ev) => console.info( diff --git a/packages/legacy/jest/static/index.js b/packages/legacy/jest/static/index.js index e5716412186..6a3a928deda 100644 --- a/packages/legacy/jest/static/index.js +++ b/packages/legacy/jest/static/index.js @@ -11,4 +11,5 @@ module.exports = { reporters: ['default'], testMatch: ['/test/unit/**/!(lib|fixture)/*.[jt]s'], testPathIgnorePatterns: ['/node_modules/', '/dist/'], + detectOpenHandles: true, };