feat(plugin): support enterprise extension (#861)

This commit is contained in:
Haze
2026-04-16 17:15:25 +08:00
committed by GitHub
Unverified
parent 2fefbf3aba
commit b884db629e
29 changed files with 847 additions and 22 deletions

View File

@@ -5,6 +5,30 @@
import { vi } from 'vitest';
import '@testing-library/jest-dom';
// Provide a minimal `electron` mock so tests that transitively import
// main-process code (logger, store, etc.) don't blow up when the Electron
// binary is not present (e.g. CI with ELECTRON_SKIP_BINARY_DOWNLOAD=1).
// Individual test files can override with their own vi.mock('electron', ...).
vi.mock('electron', () => ({
app: {
getPath: vi.fn().mockReturnValue('/tmp/clawx-test'),
getVersion: vi.fn().mockReturnValue('0.0.0-test'),
getName: vi.fn().mockReturnValue('clawx-test'),
isPackaged: false,
isReady: vi.fn().mockResolvedValue(true),
on: vi.fn(),
off: vi.fn(),
quit: vi.fn(),
whenReady: vi.fn().mockResolvedValue(undefined),
},
BrowserWindow: vi.fn(),
ipcMain: { on: vi.fn(), handle: vi.fn(), removeHandler: vi.fn() },
dialog: { showOpenDialog: vi.fn(), showMessageBox: vi.fn() },
shell: { openExternal: vi.fn() },
session: { defaultSession: { webRequest: { onBeforeSendHeaders: vi.fn() } } },
utilityProcess: {},
}));
// Mock window.electron API
const mockElectron = {
ipcRenderer: {