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 {},
    getAppPath(): string {
      return path.resolve(__dirname, '..');
    },
  },
  BrowserWindow: class {
    public webContents: DeepPartial<WebContents> = {
      openDevTools(): void {},
    };
    public loadFile(): void {}
    public on(): void {}
  },
  ipcMain: {
    on(): void {},
  },
};

rewiremock('electron').with(electronMock);
