Skip to content

Conversation

@tomerqodo
Copy link

Benchmark PR lobehub#10543

Type: Corrupted (contains bugs)

Original PR Title: ✅ test(desktop): improve test coverage for multiple modules
Original PR Description: #### 💻 Change Type

  • ✅ test

🔗 Related Issue

Closes LOBE-1215, LOBE-1216, LOBE-1217, LOBE-1218, LOBE-1219

Related to LOBE-1211 (Desktop App 测试覆盖改进计划)

🔀 Description of Change

Add comprehensive unit tests for desktop app modules to improve overall test coverage toward 60%+.

Test Coverage Added:

Module Tests Added Files
Preload Scripts 49 tests routeInterceptor, invoke, streamer, electronApi
Menu System 108 tests macOS, windows, linux, BaseMenuPlatform
Core UI (Tray) 78 tests Tray, TrayManager, MenuManager
Services 21 tests fileSearchSrv
Utilities 25 tests file-system, logger

Total: 281 new test cases covering critical desktop functionality.

Test Strategy:

  • Mock Electron APIs (Tray, Menu, BrowserWindow, ipcRenderer, contextBridge)
  • Mock Node.js modules (fs, path)
  • Mock i18n translation functions
  • Test normal flows, edge cases, and error handling
  • Follow project testing conventions and patterns

🧪 How to Test

cd apps/desktop && bunx vitest run --silent='passed-only' 'src/preload' 'src/main/menus' 'src/main/core/ui' 'src/main/services' 'src/main/utils'
  • Tested locally
  • Added/updated tests
  • No tests needed

📸 Screenshots / Videos

N/A - Test files only, no UI changes.

📝 Additional Information

This PR is part of the Desktop App Test Coverage Improvement Plan (LOBE-1211) to improve test coverage from 29% to 60%+.

🤖 Generated with Claude Code
Original PR URL: lobehub#10543

arvinxx and others added 4 commits December 2, 2025 01:31
Add comprehensive unit tests for desktop app modules to improve overall test coverage from 29% toward 60%+:

- Preload Scripts: routeInterceptor, invoke, streamer, electronApi (49 tests)
- Menu System: macOS, windows, linux, BaseMenuPlatform (108 tests)
- Core UI (Tray): Tray, TrayManager, MenuManager (78 tests)
- Services: fileSearchSrv (21 tests)
- Utilities: file-system, logger (25 tests)

Total: 281 new test cases covering critical desktop functionality.

Closes LOBE-1215, LOBE-1216, LOBE-1217, LOBE-1218, LOBE-1219

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The integration test for file search was failing because it expected all
test files to be in __tests__ directories, but some test files are now
co-located with their source files (e.g., src/preload/*.test.ts).

Updated the assertion to accept both patterns.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The routeInterceptor.test.ts uses @vitest-environment happy-dom for
browser API testing. Added happy-dom to desktop package devDependencies
to ensure CI can find the package.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

3 participants