Skip to content

Commit

Permalink
closes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
gdereese committed Mar 10, 2018
1 parent 3aa2990 commit 45646f5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
8 changes: 7 additions & 1 deletion test/clear-auth-command-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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();
});
});
22 changes: 14 additions & 8 deletions test/operation-command-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -99,7 +101,7 @@ describe('operation-command-builder', () => {
});

it('adds options for optional parameters', () => {
const vorpalInstance = vorpal();
vorpalInstance = vorpal();
const options = {
interactive: false,
operations: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand All @@ -257,4 +259,8 @@ describe('operation-command-builder', () => {

expect(command._aliases).not.toContain('foo-bar');
});

afterEach(() => {
vorpalInstance.ui.removeAllListeners();
});
});
8 changes: 7 additions & 1 deletion test/set-auth-api-key-command-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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();
});
});
8 changes: 7 additions & 1 deletion test/set-auth-basic-command-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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();
});
});

0 comments on commit 45646f5

Please sign in to comment.