Fixes local file system unit tests
This commit is contained in:
Родитель
69bb890d34
Коммит
3603a39800
|
@ -5,7 +5,7 @@ import LocalFileSystem from "./localFileSystem";
|
||||||
|
|
||||||
jest.mock("electron", () => ({
|
jest.mock("electron", () => ({
|
||||||
dialog: {
|
dialog: {
|
||||||
showOpenDialog: jest.fn(),
|
showOpenDialogSync: jest.fn(),
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
import { dialog } from "electron";
|
import { dialog } from "electron";
|
||||||
|
@ -72,7 +72,7 @@ describe("LocalFileSystem Storage Provider", () => {
|
||||||
|
|
||||||
it("selectContainer opens a dialog and resolves with selected path", async () => {
|
it("selectContainer opens a dialog and resolves with selected path", async () => {
|
||||||
const expectedContainerPath = "/path/to/container";
|
const expectedContainerPath = "/path/to/container";
|
||||||
const mockMethod = dialog.showOpenDialog as jest.Mock;
|
const mockMethod = dialog.showOpenDialogSync as jest.Mock;
|
||||||
mockMethod.mockReturnValue([expectedContainerPath]);
|
mockMethod.mockReturnValue([expectedContainerPath]);
|
||||||
|
|
||||||
const result = await localFileSystem.selectContainer();
|
const result = await localFileSystem.selectContainer();
|
||||||
|
@ -80,7 +80,7 @@ describe("LocalFileSystem Storage Provider", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("selectContainer rejects when a folder path is not returned", async () => {
|
it("selectContainer rejects when a folder path is not returned", async () => {
|
||||||
const mockMethod = dialog.showOpenDialog as jest.Mock;
|
const mockMethod = dialog.showOpenDialogSync as jest.Mock;
|
||||||
mockMethod.mockReturnValue([]);
|
mockMethod.mockReturnValue([]);
|
||||||
|
|
||||||
await expect(localFileSystem.selectContainer()).rejects.not.toBeNull();
|
await expect(localFileSystem.selectContainer()).rejects.not.toBeNull();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче