From e06bb24fbeeed101573fda411badce0eddfe8811 Mon Sep 17 00:00:00 2001 From: shafeeqd959 Date: Thu, 1 Feb 2024 13:03:03 +0530 Subject: [PATCH] fixed early access test case --- .../test/unit/commands/base-branch.test.ts | 1 + .../test/unit/commands/early-access-header.test.ts | 5 +++-- .../test/unit/commands/remove-base-branch.test.ts | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/contentstack-config/test/unit/commands/base-branch.test.ts b/packages/contentstack-config/test/unit/commands/base-branch.test.ts index 638784ee2c..dd5cdc0a5c 100644 --- a/packages/contentstack-config/test/unit/commands/base-branch.test.ts +++ b/packages/contentstack-config/test/unit/commands/base-branch.test.ts @@ -51,5 +51,6 @@ describe('base-branch command', function () { const branchStub = stub(cliux, 'table').callsFake(() => {}); await BranchGetCommand.run([]); expect(branchStub.calledOnce).to.be.true; + branchStub.restore(); }); }); diff --git a/packages/contentstack-config/test/unit/commands/early-access-header.test.ts b/packages/contentstack-config/test/unit/commands/early-access-header.test.ts index 408b8892ea..c7d04c3b75 100644 --- a/packages/contentstack-config/test/unit/commands/early-access-header.test.ts +++ b/packages/contentstack-config/test/unit/commands/early-access-header.test.ts @@ -81,8 +81,9 @@ describe('Early access header command', function () { setEarlyAccessHeaderMockData.flags.headerAlias, ]; await RemoveEarlyAccessHeaderCommand.run(args); - expect(confirmationStub.calledOnce).to.be.true; - configGetStub.restore(); + expect(confirmationStub.calledOnce).to.be.true; + configGetStub.restore(); + confirmationStub.restore() }); it('Remove early access header: without alias flag should prompt', async function () { diff --git a/packages/contentstack-config/test/unit/commands/remove-base-branch.test.ts b/packages/contentstack-config/test/unit/commands/remove-base-branch.test.ts index 87fddd4d5c..13653d3dd9 100644 --- a/packages/contentstack-config/test/unit/commands/remove-base-branch.test.ts +++ b/packages/contentstack-config/test/unit/commands/remove-base-branch.test.ts @@ -41,9 +41,10 @@ describe('Delete config', () => { const config = configHandler; const getConfig = config.get(`baseBranch.${removeConfigMockData.flags.apiKey}`); - const askConfirmation = stub(interactive, 'askConfirmation').calledOnce; + const askConfirmation = stub(interactive, 'askConfirmation'); const showSuccess = stub(cliux, 'success'); await RemoveBranchConfigCommand.run(['--stack-api-key', removeConfigMockData.flags.apiKey]); - if (getConfig && askConfirmation) expect(showSuccess.calledOnce).to.be.true; + if (getConfig && askConfirmation.calledOnce) expect(showSuccess.calledOnce).to.be.true; + askConfirmation.restore(); }); });