Skip to content

Add unit tests for codebase - #31

Merged
NullPointerDepressiveDisorder merged 41 commits into
mainfrom
Unit-Tests
Dec 27, 2025
Merged

Add unit tests for codebase#31
NullPointerDepressiveDisorder merged 41 commits into
mainfrom
Unit-Tests

Conversation

@NullPointerDepressiveDisorder

@NullPointerDepressiveDisorder NullPointerDepressiveDisorder commented Dec 22, 2025

Copy link
Copy Markdown
Owner

This pull request makes significant changes to the Xcode project structure and configuration for the MiddleDrag app. It introduces new .xcconfig files 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:

  • Refactored the Xcode project to use file system synchronized groups for Frameworks and MiddleDrag, 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]
  • Removed all source and test file references from the project file, likely to be managed automatically by the new file system synchronized groups. [1] [2] [3]

Build Configuration:

  • Added new Debug.xcconfig and Release.xcconfig files to the Frameworks directory, and included them in the respective build configurations for better separation and management of build settings. [1] [2] [3] Fbfe67feL440R440)
  • Updated the deployment target for both the main app and test targets to macOS 15.0, and added necessary frameworks (MultitouchSupport, CoreFoundation) to the test target build settings. [1] [2] [3] [4]

Sentry Integration:

  • Improved Sentry integration by updating the organization and project names, and by referencing the SENTRY_AUTH_TOKEN from 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.

- 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 AI review requested due to automatic review settings December 22, 2025 08:04
@NullPointerDepressiveDisorder NullPointerDepressiveDisorder added the tests PR adds tests label Dec 22, 2025
@sentry

sentry Bot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Codecov Report

❌ Patch coverage is 86.20690% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
MiddleDrag/Managers/DeviceMonitor.swift 80.95% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

This comment was marked as outdated.

@NullPointerDepressiveDisorder
NullPointerDepressiveDisorder marked this pull request as draft December 22, 2025 08:37
@NullPointerDepressiveDisorder
NullPointerDepressiveDisorder marked this pull request as ready for review December 22, 2025 08:47
Comment thread MiddleDrag.xcodeproj/project.pbxproj Outdated
@NullPointerDepressiveDisorder

Copy link
Copy Markdown
Owner Author

@sentry generate-test

seer-by-sentry Bot and others added 2 commits December 22, 2025 13:07
* 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>
Comment thread MiddleDrag.xcodeproj/project.pbxproj Outdated
Comment thread MiddleDrag/MiddleDragTests/PreferencesManagerTests.swift Outdated
@NullPointerDepressiveDisorder NullPointerDepressiveDisorder changed the title Add unit tests for Core and Utilities modules Add unit tests for codebase Dec 24, 2025
… and refactor tests to use an isolated `UserDefaults` instance.
Repository owner deleted a comment from seer-by-sentry Bot Dec 24, 2025
- 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
…nd idempotent `stop` calls, with updated tests.
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.
Comment thread MiddleDrag.xcodeproj/project.pbxproj
@NullPointerDepressiveDisorder
NullPointerDepressiveDisorder merged commit 7ab153b into main Dec 27, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests PR adds tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants