Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/databases/ui/db-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export class DbPanel extends DisposableObject {
return;
}

void window.withProgress(
await window.withProgress(
{
location: ProgressLocation.Notification,
title: "Searching for repositories... This might take a while",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@ import { AllCommands } from "../../../../src/common/commands";
jest.setTimeout(60_000);

describe("Db panel UI commands", () => {
// This test has some serious problems:
// - all tests use the same dbConfig file, hence the tests depend on ORDER and have to use the same list name!
// - we depend on highlighted list items when adding a repo to a list. If there's not enough time in between, a test might think a list is highlighted that doesn't exist anymore

let storagePath: string;
let dbConfigFilePath: string;

const commandManager = createVSCodeCommandManager<AllCommands>();

beforeEach(async () => {
const extension = await getActivatedExtension();

storagePath =
extension.ctx.storageUri?.fsPath || extension.ctx.globalStorageUri.fsPath;

dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
});

it("should add new remote db list", async () => {
Expand All @@ -39,10 +50,6 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.databases.variantAnalysis.repositoryLists).toHaveLength(1);
expect(dbConfig.databases.variantAnalysis.repositoryLists[0].name).toBe(
Expand All @@ -61,10 +68,6 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.databases.local.lists).toHaveLength(1);
expect(dbConfig.databases.local.lists[0].name).toBe("my-list-1");
Expand All @@ -82,10 +85,6 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.databases.variantAnalysis.repositories).toHaveLength(1);
expect(dbConfig.databases.variantAnalysis.repositories[0]).toBe(
Expand All @@ -105,10 +104,6 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.databases.variantAnalysis.owners).toHaveLength(1);
expect(dbConfig.databases.variantAnalysis.owners[0]).toBe("owner1");
Expand All @@ -128,10 +123,6 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.selected).toBeDefined();
expect(dbConfig.selected).toEqual({
Expand Down