Skip to content

Commit 681a15c

Browse files
committed
Extract dbConfigFilePath
1 parent f82b51f commit 681a15c

File tree

1 file changed

+7
-20
lines changed
  • extensions/ql-vscode/test/vscode-tests/activated-extension/databases

1 file changed

+7
-20
lines changed

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

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,20 @@ describe("Db panel UI commands", () => {
2828
// d) 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
2929

3030
let storagePath: string;
31+
let dbConfigFilePath: string;
32+
3133
const commandManager = createVSCodeCommandManager<AllCommands>();
3234

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

3638
storagePath =
3739
extension.ctx.storageUri?.fsPath || extension.ctx.globalStorageUri.fsPath;
40+
41+
dbConfigFilePath = path.join(
42+
storagePath,
43+
DbConfigStore.databaseConfigFileName,
44+
);
3845
});
3946

4047
it("should add new remote db list", async () => {
@@ -45,10 +52,6 @@ describe("Db panel UI commands", () => {
4552
);
4653

4754
// Check db config
48-
const dbConfigFilePath = path.join(
49-
storagePath,
50-
DbConfigStore.databaseConfigFileName,
51-
);
5255
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
5356
expect(dbConfig.databases.variantAnalysis.repositoryLists).toHaveLength(1);
5457
expect(dbConfig.databases.variantAnalysis.repositoryLists[0].name).toBe(
@@ -67,10 +70,6 @@ describe("Db panel UI commands", () => {
6770
);
6871

6972
// Check db config
70-
const dbConfigFilePath = path.join(
71-
storagePath,
72-
DbConfigStore.databaseConfigFileName,
73-
);
7473
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
7574
expect(dbConfig.databases.local.lists).toHaveLength(1);
7675
expect(dbConfig.databases.local.lists[0].name).toBe("my-list-1");
@@ -88,10 +87,6 @@ describe("Db panel UI commands", () => {
8887
);
8988

9089
// Check db config
91-
const dbConfigFilePath = path.join(
92-
storagePath,
93-
DbConfigStore.databaseConfigFileName,
94-
);
9590
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
9691
expect(dbConfig.databases.variantAnalysis.repositories).toHaveLength(1);
9792
expect(dbConfig.databases.variantAnalysis.repositories[0]).toBe(
@@ -111,10 +106,6 @@ describe("Db panel UI commands", () => {
111106
);
112107

113108
// Check db config
114-
const dbConfigFilePath = path.join(
115-
storagePath,
116-
DbConfigStore.databaseConfigFileName,
117-
);
118109
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
119110
expect(dbConfig.databases.variantAnalysis.owners).toHaveLength(1);
120111
expect(dbConfig.databases.variantAnalysis.owners[0]).toBe("owner1");
@@ -134,10 +125,6 @@ describe("Db panel UI commands", () => {
134125
);
135126

136127
// Check db config
137-
const dbConfigFilePath = path.join(
138-
storagePath,
139-
DbConfigStore.databaseConfigFileName,
140-
);
141128
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
142129
expect(dbConfig.selected).toBeDefined();
143130
expect(dbConfig.selected).toEqual({

0 commit comments

Comments
 (0)