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 4aa752135d
commit 3639dcb806
4 changed files with 15 additions and 8 deletions

View File

@@ -42,7 +42,10 @@ export enum WebviewReveal {
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(
panel: WebviewPanel,
fileUriOnDisk: Uri

View File

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

View File

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

View File

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