mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 18:46:34 -05:00
Add tests to NotebookUriHandler (#11959)
* NotebookUriHandler Test * set test to previous, return promise for handleUri * Added tests for file uri scheme https/http * Updated NotebookUri to await handleUri calls and add more tests
This commit is contained in:
@@ -14,6 +14,8 @@ const localize = nls.loadMessageBundle();
|
||||
import { IQuestion, confirm } from '../prompts/question';
|
||||
import CodeAdapter from '../prompts/adapter';
|
||||
import { getErrorMessage, isEditorTitleFree } from '../common/utils';
|
||||
import * as constants from '../common/constants';
|
||||
|
||||
|
||||
export class NotebookUriHandler implements vscode.UriHandler {
|
||||
private prompter = new CodeAdapter();
|
||||
@@ -24,24 +26,22 @@ export class NotebookUriHandler implements vscode.UriHandler {
|
||||
handleUri(uri: vscode.Uri): vscode.ProviderResult<void> {
|
||||
switch (uri.path) {
|
||||
case '/new':
|
||||
vscode.commands.executeCommand('notebook.command.new');
|
||||
break;
|
||||
return vscode.commands.executeCommand(constants.notebookCommandNew);
|
||||
case '/open':
|
||||
this.open(uri);
|
||||
break;
|
||||
return this.open(uri);
|
||||
default:
|
||||
vscode.window.showErrorMessage(localize('notebook.unsupportedAction', "Action {0} is not supported for this handler", uri.path));
|
||||
}
|
||||
}
|
||||
|
||||
private open(uri: vscode.Uri): void {
|
||||
private open(uri: vscode.Uri): Promise<void> {
|
||||
const data = querystring.parse(uri.query);
|
||||
|
||||
if (!data.url) {
|
||||
console.warn('Failed to open URI:', uri);
|
||||
}
|
||||
|
||||
this.openNotebook(data.url);
|
||||
return this.openNotebook(data.url);
|
||||
}
|
||||
|
||||
private async openNotebook(url: string | string[]): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user