Fix notebook file URI test by adding a required forward slash to Windows file paths. (#15550)

This commit is contained in:
Cory Rivera
2021-05-24 10:03:52 -07:00
committed by GitHub
parent 27b3904f2f
commit e2b2cfd7ca

View File

@@ -19,6 +19,7 @@ import * as constants from '../../common/constants';
import { NotebookUriHandler } from '../../protocol/notebookUriHandler';
import { CellTypes } from '../../contracts/content';
import { winPlatform } from '../../common/constants';
describe('Notebook URI Handler', function (): void {
let notebookUriHandler: NotebookUriHandler;
@@ -127,7 +128,14 @@ describe('Notebook URI Handler', function (): void {
let notebookPath: string = path.join(notebookDir, 'hello.ipynb');
await fs.mkdir(notebookDir);
let fileURI = 'azuredatastudio://microsoft.notebook/open?url=file://' + notebookPath;
let baseUrl = 'azuredatastudio://microsoft.notebook/open?url=file://';
if (process.platform === winPlatform) {
// URI paths are formatted as "hostname/path", but since we're using a local path
// we omit the host part and just add the slash. Unix paths already start with a
// forward slash, but we have to prepend it manually when using Windows paths.
baseUrl = baseUrl + '/';
}
let fileURI = baseUrl + notebookPath;
let fileNotebookUri = vscode.Uri.parse(fileURI);
let notebookContent: azdata.nb.INotebookContents = {
cells: [{