-
Notifications
You must be signed in to change notification settings - Fork 37
[TESTS] Refactor main-window-listeners to use real settings instead of mocks #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@copilot, something went wrong and you stopped. Please retry |
Co-authored-by: manusa <488391+manusa@users.noreply.github.com>
Done! I've successfully refactored the main-window-listeners tests to use real settings instead of mocks (commit 1e8151a). The refactoring:
The code is now simpler and follows black-box testing approach as recommended. |
manusa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the test suite in src/main/__tests__/main-window-listeners.test.js to eliminate mocked settings and use real settings instead, aligning with the repository's current testing practices that favor black-box testing over white-box testing.
- Removed Jest mocks for the settings module to use real settings implementation
- Replaced mock setup with
testSettings()utility for isolated test environments - Simplified test code by replacing mock implementations with direct settings calls
|



Refactored the test suite in
src/main/__tests__/main-window-listeners.test.jsto use real settings instead of mocks, following the repository's recommended testing practices.Original issue description:
Changes Made
jest.mock('../../settings')and all mock implementationstestSettings()utility for isolated test environment with temporary directoriesrequire('../../settings').loadSettings.mockImplementation()with directsettings.updateSettings()callstestSettings()returns a PromiseTesting
The refactoring reduces complexity and ensures the tests validate actual integrated behavior rather than mocked implementations.
Fixes #522
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.