1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 03:03:43 +00:00
Files
browser/apps/desktop/src/platform/services/electron-log.service.spec.ts

23 lines
612 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(), on: jest.fn() },
}));
jest.mock("@bitwarden/desktop-napi", () => {
return {
logging: {
initNapiLog: jest.fn(),
},
};
});
describe("ElectronLogMainService", () => {
it("sets dev based on electron method", () => {
globalThis.BIT_ENVIRONMENT = "development";
const logService = new ElectronLogMainService();
expect(logService).toEqual(expect.objectContaining({ isDev: true }) as any);
});
});