Merge pull request #2032 from github/shati-elena/check-for-ql-pack
Small tidy-up: Rename test file for databaseFetcher tests
This commit is contained in:
@@ -15,7 +15,7 @@ jest.setTimeout(60_000);
|
|||||||
/**
|
/**
|
||||||
* Run various integration tests for databases
|
* Run various integration tests for databases
|
||||||
*/
|
*/
|
||||||
describe("Databases", () => {
|
describe("DatabaseFetcher", () => {
|
||||||
let databaseManager: DatabaseManager;
|
let databaseManager: DatabaseManager;
|
||||||
let inputBoxStub: jest.SpiedFunction<typeof window.showInputBox>;
|
let inputBoxStub: jest.SpiedFunction<typeof window.showInputBox>;
|
||||||
let cli: CodeQLCliServer;
|
let cli: CodeQLCliServer;
|
||||||
@@ -49,39 +49,44 @@ describe("Databases", () => {
|
|||||||
await cleanDatabases(databaseManager);
|
await cleanDatabases(databaseManager);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should add a database from a folder", async () => {
|
describe("importArchiveDatabase", () => {
|
||||||
const uri = Uri.file(dbLoc);
|
it("should add a database from a folder", async () => {
|
||||||
let dbItem = await importArchiveDatabase(
|
const uri = Uri.file(dbLoc);
|
||||||
uri.toString(true),
|
let dbItem = await importArchiveDatabase(
|
||||||
databaseManager,
|
uri.toString(true),
|
||||||
storagePath,
|
databaseManager,
|
||||||
progressCallback,
|
storagePath,
|
||||||
{} as CancellationToken,
|
progressCallback,
|
||||||
cli,
|
{} as CancellationToken,
|
||||||
);
|
cli,
|
||||||
expect(dbItem).toBe(databaseManager.currentDatabaseItem);
|
);
|
||||||
expect(dbItem).toBe(databaseManager.databaseItems[0]);
|
expect(dbItem).toBe(databaseManager.currentDatabaseItem);
|
||||||
expect(dbItem).toBeDefined();
|
expect(dbItem).toBe(databaseManager.databaseItems[0]);
|
||||||
dbItem = dbItem!;
|
expect(dbItem).toBeDefined();
|
||||||
expect(dbItem.name).toBe("db");
|
dbItem = dbItem!;
|
||||||
expect(dbItem.databaseUri.fsPath).toBe(join(storagePath, "db", "db"));
|
expect(dbItem.name).toBe("db");
|
||||||
|
expect(dbItem.databaseUri.fsPath).toBe(join(storagePath, "db", "db"));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should add a database from a url", async () => {
|
describe("promptImportInternetDatabase", () => {
|
||||||
inputBoxStub.mockResolvedValue(DB_URL);
|
it("should add a database from a url", async () => {
|
||||||
|
// Provide a database URL when prompted
|
||||||
|
inputBoxStub.mockResolvedValue(DB_URL);
|
||||||
|
|
||||||
let dbItem = await promptImportInternetDatabase(
|
let dbItem = await promptImportInternetDatabase(
|
||||||
databaseManager,
|
databaseManager,
|
||||||
storagePath,
|
storagePath,
|
||||||
progressCallback,
|
progressCallback,
|
||||||
{} as CancellationToken,
|
{} as CancellationToken,
|
||||||
cli,
|
cli,
|
||||||
);
|
);
|
||||||
expect(dbItem).toBeDefined();
|
expect(dbItem).toBeDefined();
|
||||||
dbItem = dbItem!;
|
dbItem = dbItem!;
|
||||||
expect(dbItem.name).toBe("db");
|
expect(dbItem.name).toBe("db");
|
||||||
expect(dbItem.databaseUri.fsPath).toBe(
|
expect(dbItem.databaseUri.fsPath).toBe(
|
||||||
join(storagePath, "simple-db", "db"),
|
join(storagePath, "simple-db", "db"),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user