Skip to content

Commit ecbc458

Browse files
authored
Merge pull request #2802 from github/nora/minor-integration-test-improvement
Minor test updates for `db-panel.test`
2 parents 93652fc + 9aff989 commit ecbc458

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

extensions/ql-vscode/src/databases/ui/db-panel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export class DbPanel extends DisposableObject {
409409
return;
410410
}
411411

412-
void window.withProgress(
412+
await window.withProgress(
413413
{
414414
location: ProgressLocation.Notification,
415415
title: "Searching for repositories... This might take a while",

extensions/ql-vscode/test/vscode-tests/activated-extension/databases/db-panel.test.ts

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,25 @@ import { AllCommands } from "../../../../src/common/commands";
2121
jest.setTimeout(60_000);
2222

2323
describe("Db panel UI commands", () => {
24+
// This test has some serious problems:
25+
// - all tests use the same dbConfig file, hence the tests depend on ORDER and have to use the same list name!
26+
// - 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
27+
2428
let storagePath: string;
29+
let dbConfigFilePath: string;
30+
2531
const commandManager = createVSCodeCommandManager<AllCommands>();
2632

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

3036
storagePath =
3137
extension.ctx.storageUri?.fsPath || extension.ctx.globalStorageUri.fsPath;
38+
39+
dbConfigFilePath = path.join(
40+
storagePath,
41+
DbConfigStore.databaseConfigFileName,
42+
);
3243
});
3344

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

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

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

8487
// Check db config
85-
const dbConfigFilePath = path.join(
86-
storagePath,
87-
DbConfigStore.databaseConfigFileName,
88-
);
8988
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
9089
expect(dbConfig.databases.variantAnalysis.repositories).toHaveLength(1);
9190
expect(dbConfig.databases.variantAnalysis.repositories[0]).toBe(
@@ -105,10 +104,6 @@ describe("Db panel UI commands", () => {
105104
);
106105

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

130125
// Check db config
131-
const dbConfigFilePath = path.join(
132-
storagePath,
133-
DbConfigStore.databaseConfigFileName,
134-
);
135126
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
136127
expect(dbConfig.selected).toBeDefined();
137128
expect(dbConfig.selected).toEqual({

0 commit comments

Comments
 (0)