diff --git a/test/utils/e2e-framework-mock-manager.js b/test/utils/e2e-framework-mock-manager.js index b51e5d6d20..98a0208ebe 100644 --- a/test/utils/e2e-framework-mock-manager.js +++ b/test/utils/e2e-framework-mock-manager.js @@ -42,33 +42,29 @@ const setupStripe = () => { }; const mockLabsEnabled = (flag, alpha = true) => { - mocks.labs = mocks.labs || {}; - // We assume we should enable alpha experiments unless explicitly told not to! if (!alpha) { configUtils.set('enableDeveloperExperiments', true); } - if (mocks.labs[flag]) { - mocks.labs[flag].returns(true); - } else { - mocks.labs[flag] = sinon.stub(labs, 'isSet').withArgs(flag).returns(true); + if (!mocks.labs) { + mocks.labs = sinon.stub(labs, 'isSet'); } + + mocks.labs.withArgs(flag).returns(true); }; const mockLabsDisabled = (flag, alpha = true) => { - mocks.labs = mocks.labs || {}; - // We assume we should enable alpha experiments unless explicitly told not to! if (!alpha) { configUtils.set('enableDeveloperExperiments', true); } - if (mocks.labs[flag]) { - mocks.labs[flag].returns(false); - } else { - mocks.labs[flag] = sinon.stub(labs, 'isSet').withArgs(flag).returns(false); + if (!mocks.labs) { + mocks.labs = sinon.stub(labs, 'isSet'); } + + mocks.labs.withArgs(flag).returns(false); }; const sentEmailCount = (count) => {