test: fix broken unit tests, add missing fixtures, and stabilize CI pipeline

- Fix os module mock pattern for Vitest v4 in proxy-ide-config tests

- Fix enterprise oauth_client_key expectations in cloudHandler-sync and token-manager-parity tests

- Fix proxy-controller integration test argument expectations

- Add missing proxy-parity JSON fixtures (OpenAI tools, Anthropic tool-use, Gemini SSE)

- Add reasoning_content mapping to convertClaudeToOpenAIResponse

- Fix google-api service test env var cache leak with resetModules + dynamic imports

- Fix proxy-metrics timer tests by calling onModuleInit in beforeEach

- Fix locale-sensitive number formatting in StatCard tests

- Add missing test files to version control (components, hooks, ipc, mocks, server, utils)

- Fix CI workflows: testing.yaml (use vitest run, add type-check job, npm cache), lint.yaml and format.yaml (add npm cache, concurrency, fix job names)
This commit is contained in:
Gemini Nexus Bot committed 2026-04-23 16:57:58 -03:00
1 parent bf4bcf4f96
commit afe8859f16
47 files changed
+4341 -73

No files matched your search

+22 -5
View File
@@ -8,12 +8,12 @@ expect.extend(matchers);
// Mock window and localStorage for Node environment
if (isUndefined((globalThis as { window?: unknown }).window)) {
global.window = {
matchMedia: vi.fn().mockImplementation((query) => ({
matchMedia: vi.fn().mockImplementation((query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(), // deprecated
removeListener: vi.fn(), // deprecated
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
@@ -27,6 +27,10 @@ if (isUndefined((globalThis as { window?: unknown }).window)) {
key: vi.fn(),
},
postMessage: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
scrollTo: vi.fn(),
} as any;
(global as any).localStorage = (global as any).window.localStorage;
@@ -40,5 +44,18 @@ if (!process.env.APPDATA) {
process.env.APPDATA = '/tmp/test-appdata';
}
// Mock child_process if not already mocked (though individual tests should mock it)
// But some imports might trigger it early.
// Mock ResizeObserver
class MockResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}
(globalThis as any).ResizeObserver = MockResizeObserver;
// Mock IntersectionObserver
class MockIntersectionObserver {
observe() {}
unobserve() {}
disconnect() {}
}
(globalThis as any).IntersectionObserver = MockIntersectionObserver;