Add unit tests for codebase - #31
Merged
Merged
Conversation
- Add MouseEventGeneratorTests.swift with 13 tests covering: - Initialization and property defaults - Drag state edge cases (cancel/end/update without active drag) - Static mouse location method - Add PreferencesManagerTests.swift with 9 tests covering: - Default preferences loading - Save/load roundtrip verification - Palm rejection preferences - Edge cases for sensitivity and exclusion zone values - Singleton pattern verification - Add AnalyticsManagerTests.swift with 15 tests covering: - Log category enum values - CrashReporter singleton pattern - Log function smoke tests for all levels - Default disabled states for crash/performance monitoring - Update project.pbxproj to include new test files in MiddleDragTests target Total test count increased from ~52 to 80 tests.
Copilot started reviewing on behalf of
NullPointerDepressiveDisorder
December 22, 2025 08:04
View session
Contributor
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
NullPointerDepressiveDisorder
marked this pull request as draft
December 22, 2025 08:37
NullPointerDepressiveDisorder
marked this pull request as ready for review
December 22, 2025 08:47
Owner
Author
|
@sentry generate-test |
* test: add unit tests for PR#31 * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> * Rename test and improve isAvailable validation Updated test to ensure isAvailable method does not crash and returns consistent results. Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> --------- Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ginManagerTests.swift`.
…t and update file exceptions.
…MultitouchSupport and CoreFoundation frameworks.
…ings from test target.
…shes and verify basic sequences
… and refactor tests to use an isolated `UserDefaults` instance.
…tions, tap, and drag detection.
…cts, and drag state management.
- Define protocol with delegate, start(), and stop() methods - Enables mocking of device monitoring for unit tests - Improves testability of MultitouchManager
- Add TouchDeviceProviding protocol conformance - No logic changes - class already implements required methods
- Add deviceProviderFactory parameter to init for DI - Replace direct DeviceMonitor instantiation with factory call - Maintain backward compatibility with default factory - Enables injecting mocks for unit testing
- Implement TouchDeviceProviding protocol - Track start/stop call counts for verification - Add simulateTouches() helper for future integration tests
- Add 6 new tests using MockDeviceMonitor injection - Cover start/stop lifecycle, state transitions, toggle behavior - Previously untestable without hardware access
- Add DeviceMonitorTests for basic lifecycle testing - Add Log.Category.crash and osLog property tests to AnalyticsManager
- Add MockDeviceMonitor to membership exceptions - Add DeviceMonitorTests to project
…agTests directory.
…nd idempotent `stop` calls, with updated tests.
…e project build configurations.
Add comprehensive tests for MultitouchManager: - GestureRecognizerDelegate state transition tests - Update dragging with movement variations - DeviceMonitor delegate when enabled/disabled - Edge cases: toggle/stop while dragging Add tests for DeviceMonitor: - Delegate handling (set, clear, weak reference) - Multiple instance ownership - Instance lifecycle All delegate callbacks and gesture handling now at 100% coverage.
…ing them in a class property.
…i-instance resource management.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request makes significant changes to the Xcode project structure and configuration for the MiddleDrag app. It introduces new
.xcconfigfiles for managing build settings, restructures the project for better organization and synchronization, updates the deployment target to macOS 15.0, and improves Sentry integration by updating environment variables and project settings.The most important changes are:
Project Structure and Organization:
FrameworksandMiddleDrag, improving consistency between the file system and the Xcode project navigator. This includes removing the old groupings and introducing new root groups with exception sets for specific files. [1] [2] [3] [4] [5]Build Configuration:
Debug.xcconfigandRelease.xcconfigfiles to theFrameworksdirectory, and included them in the respective build configurations for better separation and management of build settings. [1] [2] [3] Fbfe67feL440R440)MultitouchSupport,CoreFoundation) to the test target build settings. [1] [2] [3] [4]Sentry Integration:
SENTRY_AUTH_TOKENfrom the environment instead of hardcoding it in the scheme. [1] [2]These changes modernize the project setup, improve maintainability, and enhance security for sensitive configuration.