mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
Swapping vscode calls for ApiWrapper for testability (#10267)
* swapping vscode calls for apiwrapper for testability * Adding mainController tests * Adding unit tests for input validation * Adding project controller tests, reorganizing error handling * Removing commented-out code
This commit is contained in:
@@ -11,10 +11,10 @@ import { promises as fs } from 'fs';
|
||||
import should = require('should');
|
||||
import { AssertionError } from 'assert';
|
||||
|
||||
export function shouldThrowSpecificError(block: Function, expectedMessage: string) {
|
||||
export async function shouldThrowSpecificError(block: Function, expectedMessage: string, details?: string) {
|
||||
let succeeded = false;
|
||||
try {
|
||||
block();
|
||||
await block();
|
||||
succeeded = true;
|
||||
}
|
||||
catch (err) {
|
||||
@@ -22,7 +22,7 @@ export function shouldThrowSpecificError(block: Function, expectedMessage: strin
|
||||
}
|
||||
|
||||
if (succeeded) {
|
||||
throw new AssertionError({ message: 'Operation succeeded, but expected failure with exception: "' + expectedMessage + '"' });
|
||||
throw new AssertionError({ message: `Operation succeeded, but expected failure with exception: "${expectedMessage}".${details ? ' ' + details : ''}` });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user