From 33c4fd3efe831925615f0fe09f8714308ed364db Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Mon, 27 Dec 2021 16:47:00 +0100 Subject: refactor: Simplify preload Jest mocking keeps the electron interaction testable --- packages/preload/src/__mocks__/electron.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 packages/preload/src/__mocks__/electron.ts (limited to 'packages/preload/src/__mocks__') diff --git a/packages/preload/src/__mocks__/electron.ts b/packages/preload/src/__mocks__/electron.ts new file mode 100644 index 0000000..52cddf9 --- /dev/null +++ b/packages/preload/src/__mocks__/electron.ts @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021-2022 Kristóf Marussy + * + * This file is part of Sophie. + * + * Sophie is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export const ipcRenderer = { + invoke: jest.fn(), + on: jest.fn(), + send: jest.fn(), +}; -- cgit v1.2.3-54-g00ecf