Skip to content

Commit

Permalink
Tests: Output Content Provider query related functionality (#626)
Browse files Browse the repository at this point in the history
* started redoing handler tests

* adding more test logic

* adding more mocks

* cleaning up cases code and adding more commented out tests

* adding tests for query lifecycle related functions

* cleaning up tests and adding a new one

* change anon function
  • Loading branch information
Raymondd authored Jan 20, 2017
1 parent 1f90cb0 commit a0df43a
Show file tree
Hide file tree
Showing 3 changed files with 306 additions and 83 deletions.
18 changes: 15 additions & 3 deletions src/models/SqlOutputContentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ export class SqlOutputContentProvider implements vscode.TextDocumentContentProvi
queryRunner.runQuery(selection);
let paneTitle = Utils.formatString(Constants.titleResultsPane, queryRunner.title);
// Always run this command even if just updating to avoid a bug - tfs 8686842
this.displayResultPane(resultsUri, paneTitle);
}

// Function to render resultspane content
public displayResultPane(resultsUri: string, paneTitle: string): void {
// Check if the results window already exists
let activeTextEditor = this._vscodeWrapper.activeTextEditor;
let previewCommandPromise;
Expand Down Expand Up @@ -306,7 +310,7 @@ export class SqlOutputContentProvider implements vscode.TextDocumentContentProvi
this._vscodeWrapper.showTextDocument(activeTextEditor.document, activeTextEditor.viewColumn);
}
});
}
};

public cancelQuery(input: QueryRunner | string): void {
let self = this;
Expand Down Expand Up @@ -561,8 +565,16 @@ export class SqlOutputContentProvider implements vscode.TextDocumentContentProvi
return viewColumn;
}

// Exposing the wrapper for testing purposes
public setVscodeWrapper(wrapper: VscodeWrapper): void {
// Exposing some variables for testing purposes only
set setDisplayResultPane(implementation: (var1: string, var2: string) => void) {
this.displayResultPane = implementation;
}

set setVscodeWrapper(wrapper: VscodeWrapper) {
this._vscodeWrapper = wrapper;
}

get getResultsMap(): Map<string, QueryRunnerState> {
return this._queryResultsMap;
}
}
Loading

0 comments on commit a0df43a

Please sign in to comment.