feat: Security
This commit is contained in:
@@ -7,13 +7,24 @@ import {
|
||||
afterEach
|
||||
} from 'vitest';
|
||||
|
||||
// Mock Electron modules before importing the module under test
|
||||
const mockGetSystemIdleTime = vi.fn(() => 0);
|
||||
const mockSend = vi.fn();
|
||||
const mockGetMainWindow = vi.fn(() => ({
|
||||
isDestroyed: () => false,
|
||||
webContents: { send: mockSend }
|
||||
}));
|
||||
const {
|
||||
mockGetSystemIdleTime,
|
||||
mockSend,
|
||||
mockGetMainWindow
|
||||
} = vi.hoisted(() => {
|
||||
const send = vi.fn();
|
||||
const getSystemIdleTime = vi.fn(() => 0);
|
||||
const getMainWindow = vi.fn(() => ({
|
||||
isDestroyed: () => false,
|
||||
webContents: { send }
|
||||
}));
|
||||
|
||||
return {
|
||||
mockGetSystemIdleTime: getSystemIdleTime,
|
||||
mockSend: send,
|
||||
mockGetMainWindow: getMainWindow
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('electron', () => ({
|
||||
powerMonitor: {
|
||||
|
||||
Reference in New Issue
Block a user