diff --git a/deploy/app.spec.js b/deploy/app.spec.js index 5427e5d80d0b450b2dba959375fc46c6c4cefe47..cf0cfd703e22e1d2b302a79b2222fe3239c5025c 100644 --- a/deploy/app.spec.js +++ b/deploy/app.spec.js @@ -25,13 +25,6 @@ describe('authentication', () => { const authConfigureAuthStub = sinon.stub(auth, 'configureAuth') const authIsReadyStub = sinon.stub(auth, 'ready') - require.cache[require.resolve('./datasets')] = { - exports: { - router: (req, res, next) => next(), - ready: async () => true - } - } - require.cache[require.resolve('./saneUrl')] = { exports: { router: (req, res, next) => next(), @@ -61,7 +54,6 @@ describe('authentication', () => { }) after(() => { - delete require.cache[require.resolve('./datasets')] delete require.cache[require.resolve('./saneUrl')] delete require.cache[require.resolve('./user')] delete require.cache[require.resolve('./constants')] diff --git a/deploy/auth/index.spec.js b/deploy/auth/index.spec.js index a75affe6ffa1c07c4456cb12d61c71d75e090d33..84691ddd6ccae9169f321858453c2eacf0dcb28c 100644 --- a/deploy/auth/index.spec.js +++ b/deploy/auth/index.spec.js @@ -1,8 +1,6 @@ const sinon = require('sinon') const { assert, expect } = require('chai') const initPassportJsStub = sinon.stub() - -const hbpOidcStub = sinon.stub() const hbpOidcV2Stub = sinon.stub() const appGetStub = sinon.stub() @@ -12,9 +10,6 @@ describe('auth/index.js', () => { require.cache[require.resolve('./util')] = { exports: { initPassportJs: initPassportJsStub } } - require.cache[require.resolve('./hbp-oidc')] = { - exports: hbpOidcStub - } require.cache[require.resolve('./hbp-oidc-v2')] = { exports: { bootstrapApp: hbpOidcV2Stub @@ -24,9 +19,7 @@ describe('auth/index.js', () => { beforeEach(() => { delete require.cache[require.resolve('./index.js')] - hbpOidcStub.returns({}) hbpOidcV2Stub.returns({}) - hbpOidcStub.resetHistory() hbpOidcV2Stub.resetHistory() }) @@ -37,11 +30,6 @@ describe('auth/index.js', () => { const dummyObj = { get: appGetStub } await configureAuth(dummyObj) - assert( - hbpOidcStub.called, - 'hbpOidc called' - ) - assert( hbpOidcV2Stub.called, 'hbpOidcV2 called' @@ -58,7 +46,7 @@ describe('auth/index.js', () => { const { configureAuth } = require('./index.js') const dummyObj = { get: appGetStub } - hbpOidcStub.throws(`throw error`) + hbpOidcV2Stub.throws(`throw error`) try { @@ -76,14 +64,10 @@ describe('auth/index.js', () => { } catch (e) { assert( - hbpOidcStub.calledThrice, - 'hbpOidc called thrice' + hbpOidcV2Stub.calledThrice, + 'hbpOidcv2 called thrice' ) - assert( - !hbpOidcV2Stub.called, - 'hbpOidcV2 not called' - ) } }) }) @@ -105,7 +89,7 @@ describe('auth/index.js', () => { const { configureAuth, ready } = require('./index.js') const dummyObj = { get: appGetStub } - hbpOidcStub.throws(`throw error`) + hbpOidcV2Stub.throws(`throw error`) try { await (() => new Promise((rs, rj) => {