diff --git a/test/clear-auth-command-builder.spec.ts b/test/clear-auth-command-builder.spec.ts index dd1921a..86b1cef 100644 --- a/test/clear-auth-command-builder.spec.ts +++ b/test/clear-auth-command-builder.spec.ts @@ -3,8 +3,10 @@ import * as vorpal from 'vorpal'; import { ClearAuthCommandBuilder } from '../src/clear-auth-command-builder'; describe('clear-auth-command-builder', () => { + let vorpalInstance = null; + it('adds command for each scheme', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -31,4 +33,8 @@ describe('clear-auth-command-builder', () => { expect(commands[0]._name).toBe('clear-auth bar-auth'); expect(commands[1]._name).toBe('clear-auth foo-auth'); }); + + afterEach(() => { + vorpalInstance.ui.removeAllListeners(); + }); }); diff --git a/test/operation-command-builder.spec.ts b/test/operation-command-builder.spec.ts index 2def6bd..3268481 100644 --- a/test/operation-command-builder.spec.ts +++ b/test/operation-command-builder.spec.ts @@ -5,8 +5,10 @@ import { CommandGroupTypes } from '../src/command-group-types'; import { OperationCommandBuilder } from '../src/operation-command-builder'; describe('operation-command-builder', () => { + let vorpalInstance = null; + it('adds option for request content type if operation specifies consumes values', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -38,7 +40,7 @@ describe('operation-command-builder', () => { }); it('adds option for response body output if operation specifies produces values', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -67,7 +69,7 @@ describe('operation-command-builder', () => { }); it('adds option for response content type if operation specifies produces values', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -99,7 +101,7 @@ describe('operation-command-builder', () => { }); it('adds options for optional parameters', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -144,7 +146,7 @@ describe('operation-command-builder', () => { }); it('uses specified parts as command name', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -175,7 +177,7 @@ describe('operation-command-builder', () => { }); it('uses operation summary as command description', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -203,7 +205,7 @@ describe('operation-command-builder', () => { }); it('sets alias from operation id if operation commands are being grouped', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -231,7 +233,7 @@ describe('operation-command-builder', () => { }); it('sets no alias if operation commands are not being grouped', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -257,4 +259,8 @@ describe('operation-command-builder', () => { expect(command._aliases).not.toContain('foo-bar'); }); + + afterEach(() => { + vorpalInstance.ui.removeAllListeners(); + }); }); diff --git a/test/set-auth-api-key-command-builder.spec.ts b/test/set-auth-api-key-command-builder.spec.ts index 57455e8..c4b9acf 100644 --- a/test/set-auth-api-key-command-builder.spec.ts +++ b/test/set-auth-api-key-command-builder.spec.ts @@ -3,8 +3,10 @@ import * as vorpal from 'vorpal'; import { SetAuthApiKeyCommandBuilder } from '../src/set-auth-api-key-command-builder'; describe('set-auth-api-key-command-builder', () => { + let vorpalInstance = null; + it('adds command for each apiKey scheme', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -31,4 +33,8 @@ describe('set-auth-api-key-command-builder', () => { expect(commands[0]._name).toBe('set-auth bar-auth'); expect(commands[1]._name).toBe('set-auth foo-auth'); }); + + afterEach(() => { + vorpalInstance.ui.removeAllListeners(); + }); }); diff --git a/test/set-auth-basic-command-builder.spec.ts b/test/set-auth-basic-command-builder.spec.ts index dea5189..a4e971b 100644 --- a/test/set-auth-basic-command-builder.spec.ts +++ b/test/set-auth-basic-command-builder.spec.ts @@ -3,8 +3,10 @@ import * as vorpal from 'vorpal'; import { SetAuthBasicCommandBuilder } from '../src/set-auth-basic-command-builder'; describe('set-auth-basic-command-builder', () => { + let vorpalInstance = null; + it('adds command for each basic scheme', () => { - const vorpalInstance = vorpal(); + vorpalInstance = vorpal(); const options = { interactive: false, operations: { @@ -31,4 +33,8 @@ describe('set-auth-basic-command-builder', () => { expect(commands[0]._name).toBe('set-auth bar-auth'); expect(commands[1]._name).toBe('set-auth foo-auth'); }); + + afterEach(() => { + vorpalInstance.ui.removeAllListeners(); + }); });