Skip to content

test: comprehensive test coverage + bugfixes (1821 tests, 66 files)#1566

Open
riccelso wants to merge 8 commits intoeigent-ai:mainfrom
riccelso:test-coverage-bugfixes
Open

test: comprehensive test coverage + bugfixes (1821 tests, 66 files)#1566
riccelso wants to merge 8 commits intoeigent-ai:mainfrom
riccelso:test-coverage-bugfixes

Conversation

@riccelso
Copy link
Copy Markdown

Summary

This PR adds comprehensive test coverage and fixes pre-existing bugs across the Eigent codebase.

Bug Fixes

  • useIntegrationManagement render loop — Extracted items/configs/email into refs with useEffect updates, stabilized useCallback deps to prevent cascading useEffect re-registrations
  • chatStore crash guard — Added Array.isArray(res) guard to prevent crash when API returns non-array response

Test Infrastructure

  • Stabilized vitest config (forks pool, maxForks=2) and shared mocks for 66-file test suite
  • Fixed 10 pre-existing test failures (ChatBox, SearchInput, installation flow, integration tests)

New Test Files (38 files, 1821 total tests)

  • 10 Zustand stores — authStore, globalStore, sidebarStore, triggerStore, triggerTaskStore, activityLogStore, workflowViewportStore, pageTabStore, projectStore, skillsStore
  • 9 lib/utility modules — skillToolkit, index, queryClient, llm, fileUtils, oauth, replay, share, htmlSanitization
  • 8 React hooks — use-app-version, use-mobile, use-is-in-view, useChatStoreAdapter, useTriggerQueries, useBackgroundTaskProcessor, useExecutionSubscription, useIntegrationManagement
  • 9 Electron main-process modules — init, copy, update, webview, envUtil, mcpConfig, process, safeWebContentsSend, log
  • 3 API/service modules — http, triggerApi, historyApi

Test plan

  • All 1821 tests pass across 66 test files
  • Pre-commit hooks (ESLint + Prettier) pass on all files
  • Source bug fixes verified with targeted regression tests

- Switch vitest pool to forks with maxForks=2 to prevent OOM
- Add ipcRenderer.off to test/setup.ts global mock
- Update proxy.mock.ts with waitForBackendReady, substring URL matching
- Add getVenvPythonPath, getPrebuiltPythonDir to environmentMocks
- Add onBackendReady, restartBackend to electronMocks
…in chatStore

- useIntegrationManagement: extract items/configs/email into refs to
  stabilize useCallback identities and prevent cascading useEffect
  re-registrations that caused infinite re-renders with renderHook
- chatStore: add Array.isArray(res) guard to prevent crash when API
  returns non-array response for chat history
…n suites

- Fix duplicate data-testid and API path migration in ChatBox tests
- Remove invalid null/undefined prop tests from SearchInput
- Update installation flow tests for waiting-backend state changes
- Fix integration tests for /api/ to /api/v1/ URL path migration
- Add missing QueryClientProvider in ChatBox integration test
Coverage: authStore(41), globalStore(15), sidebarStore(11),
triggerStore(38), triggerTaskStore(25), activityLogStore(27),
workflowViewportStore(13), pageTabStore(25), projectStore(116),
skillsStore(67)
Coverage: skillToolkit(24), index(21), queryClient(12), llm(14),
fileUtils(6), oauth(41), replay(22), share(7),
htmlSanitization(91)
Coverage: use-app-version(6), use-is-in-view(12), use-mobile(9),
useChatStoreAdapter(20), useTriggerQueries(26),
useBackgroundTaskProcessor(40), useExecutionSubscription(49),
useIntegrationManagement(36)
Coverage: init(52), copy(9), update(23), webview(35),
envUtil(60), mcpConfig(66), process(85), safeWebContentsSend(6),
log(8)
Coverage: http.ts(64), triggerApi(27), historyApi(40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant