Fixes local file system unit tests

This commit is contained in:
Wallace Breza 2020-11-04 14:31:30 -08:00
Родитель 69bb890d34
Коммит 3603a39800
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E42F49C5CC6A37A2
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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();