RenaiApp/mocks/electron.ts

26 lines
570 B
TypeScript

import path from 'path';
import { rewiremock } from './rewiremock';
import WebContents = Electron.WebContents;
const electronMock: DeepPartial<typeof Electron> = {
app: {
on(): void {},
getPath(name: string): string {
return path.resolve('test-paths', name);
},
quit(): void {},
},
BrowserWindow: class {
public webContents: DeepPartial<WebContents> = {
openDevTools(): void {},
};
public loadFile(): void {}
public on(): void {}
},
ipcMain: {
on(): void {},
},
};
rewiremock('electron').with(electronMock);