Remove as unknown as ExtensionContext
This commit is contained in:
@@ -48,6 +48,7 @@ describe("local databases", () => {
|
||||
>;
|
||||
|
||||
let dir: tmp.DirResult;
|
||||
let extensionContextStoragePath: string;
|
||||
|
||||
beforeEach(() => {
|
||||
dir = tmp.dirSync();
|
||||
@@ -65,16 +66,24 @@ describe("local databases", () => {
|
||||
.spyOn(helpers, "showBinaryChoiceDialog")
|
||||
.mockResolvedValue(true);
|
||||
|
||||
extensionContext = {
|
||||
workspaceState: {
|
||||
update: updateSpy,
|
||||
get: () => [],
|
||||
extensionContextStoragePath = dir.name;
|
||||
|
||||
extensionContext = mockedObject<ExtensionContext>(
|
||||
{
|
||||
workspaceState: {
|
||||
update: updateSpy,
|
||||
get: () => [],
|
||||
},
|
||||
},
|
||||
// pretend like databases added in the temp dir are controlled by the extension
|
||||
// so that they are deleted upon removal
|
||||
storagePath: dir.name,
|
||||
storageUri: Uri.parse(dir.name),
|
||||
} as unknown as ExtensionContext;
|
||||
{
|
||||
dynamicProperties: {
|
||||
// pretend like databases added in the temp dir are controlled by the extension
|
||||
// so that they are deleted upon removal
|
||||
storagePath: () => extensionContextStoragePath,
|
||||
storageUri: () => Uri.parse(extensionContextStoragePath),
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
databaseManager = new DatabaseManager(
|
||||
extensionContext,
|
||||
@@ -267,6 +276,7 @@ describe("local databases", () => {
|
||||
|
||||
// pretend that the database location is not controlled by the extension
|
||||
(databaseManager as any).ctx.storagePath = "hucairz";
|
||||
extensionContextStoragePath = "hucairz";
|
||||
|
||||
await databaseManager.removeDatabaseItem(
|
||||
{} as ProgressCallback,
|
||||
|
||||
@@ -20,6 +20,7 @@ import { EvalLogViewer } from "../../../../src/eval-log-viewer";
|
||||
import { QueryRunner } from "../../../../src/queryRunner";
|
||||
import { VariantAnalysisManager } from "../../../../src/variant-analysis/variant-analysis-manager";
|
||||
import { QueryHistoryManager } from "../../../../src/query-history/query-history-manager";
|
||||
import { mockedObject } from "../../utils/mocking.helpers";
|
||||
|
||||
// set a higher timeout since recursive delete may take a while, expecially on Windows.
|
||||
jest.setTimeout(120000);
|
||||
@@ -75,10 +76,11 @@ describe("Variant Analyses and QueryHistoryManager", () => {
|
||||
variantAnalysisManagerStub,
|
||||
{} as EvalLogViewer,
|
||||
STORAGE_DIR,
|
||||
{
|
||||
mockedObject<ExtensionContext>({
|
||||
globalStorageUri: Uri.file(STORAGE_DIR),
|
||||
storageUri: undefined,
|
||||
extensionPath: EXTENSION_PATH,
|
||||
} as ExtensionContext,
|
||||
}),
|
||||
{
|
||||
onDidChangeConfiguration: () => new DisposableBucket(),
|
||||
} as unknown as QueryHistoryConfig,
|
||||
|
||||
Reference in New Issue
Block a user