mirror of
https://github.com/bitwarden/browser
synced 2026-01-08 19:43:45 +00:00
* Disable node integration and enable context isolation * Review comments * Log in renderer through IPC * Missed imports * Mock electron API * resourcesPath is undefined in the preload, but process.windowsStore works correctly * Replace fromBufferToUtf8 conditional implementation for the `buffer` package The current non-node implementation is different than the node implementation, as the non-node would break when the contents can't be parsed as a URI component. Replacing the impl by the `buffer` package makes the result match in both environments. * Fix lint * Add some more tests * Remove buffer from devDependencies
15 lines
470 B
TypeScript
15 lines
470 B
TypeScript
import { ElectronLogMainService } from "./electron-log.main.service";
|
|
|
|
// Mock the use of the electron API to avoid errors
|
|
jest.mock("electron", () => ({
|
|
ipcMain: { handle: jest.fn() },
|
|
}));
|
|
|
|
describe("ElectronLogMainService", () => {
|
|
it("sets dev based on electron method", () => {
|
|
process.env.ELECTRON_IS_DEV = "1";
|
|
const logService = new ElectronLogMainService();
|
|
expect(logService).toEqual(expect.objectContaining({ isDev: true }) as any);
|
|
});
|
|
});
|