Fix tests and reformatting

* Fix command-linting tests.
* Fix failing windows test and Use Uri.parse(_, true)
* Use  Uri.parse(_, true). That is the preferred API.
* Reformat comments.
This commit is contained in:
Andrew Eisenberg
2020-07-09 13:15:56 -07:00
parent af965c941a
commit 8459edb57c
4 changed files with 15 additions and 8 deletions

View File

@@ -44,7 +44,10 @@ export enum WebviewReveal {
NotForced, NotForced,
} }
/** Converts a filesystem URI into a webview URI string that the given panel can use to read the file. */ /**
* Converts a filesystem URI into a webview URI string that the given panel
* can use to read the file.
*/
export function fileUriToWebviewUri( export function fileUriToWebviewUri(
panel: WebviewPanel, panel: WebviewPanel,
fileUriOnDisk: Uri fileUriOnDisk: Uri

View File

@@ -36,7 +36,7 @@ describe('fileRangeFromURI', () => {
function createMockDatabaseItem(): DatabaseItem { function createMockDatabaseItem(): DatabaseItem {
return { return {
resolveSourceFile: (uri: string) => Uri.parse('file://' + uri, true) resolveSourceFile: (file: string) => Uri.file(file)
} as DatabaseItem; } as DatabaseItem;
} }
}); });

View File

@@ -32,6 +32,7 @@ describe('interface-utils', () => {
localResourceRoots: [fileUriOnDisk], localResourceRoots: [fileUriOnDisk],
} }
); );
after(function() { after(function() {
panel.dispose(); panel.dispose();
tmpFile.removeCallback(); tmpFile.removeCallback();

View File

@@ -29,15 +29,20 @@ describe('commands declared in package.json', function() {
commands.forEach((commandDecl: CmdDecl) => { commands.forEach((commandDecl: CmdDecl) => {
const { command, title } = commandDecl; const { command, title } = commandDecl;
if (command.match(/^codeQL\./) if (
command.match(/^codeQL\./)
|| command.match(/^codeQLQueryResults\./) || command.match(/^codeQLQueryResults\./)
|| command.match(/^codeQLTests\./)) { || command.match(/^codeQLTests\./)
) {
paletteCmds.add(command); paletteCmds.add(command);
expect(title).not.to.be.undefined; expect(title).not.to.be.undefined;
commandTitles[command] = title!; commandTitles[command] = title!;
} }
else if (command.match(/^codeQLDatabases\./) else if (
|| command.match(/^codeQLQueryHistory\./)) { command.match(/^codeQLDatabases\./)
|| command.match(/^codeQLQueryHistory\./)
|| command.match(/^codeQLAstViewer\./)
) {
scopedCmds.add(command); scopedCmds.add(command);
expect(title).not.to.be.undefined; expect(title).not.to.be.undefined;
commandTitles[command] = title!; commandTitles[command] = title!;
@@ -97,5 +102,3 @@ describe('commands declared in package.json', function() {
}); });