Add XCTest target with 49 tests (KeyboardShortcut, PreferencesManager, WindowManager)#174
Conversation
…ger, WindowManager - New SwiftShiftTests unit test bundle with @testable import - 26 KeyboardShortcut tests: encoding, display strings, modifier flags, equatable - 17 PreferencesManager tests: ignored app CRUD, caching, migration, system protection - 6 WindowManager tests: coordinate conversion, window bounds calculation - Added 'make test' target to Makefile - Updated CI workflow with parallel test job on PRs and main pushes - Closes #173
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe PR introduces a Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (1)
SwiftShiftTests/PreferencesManagerTests.swift (1)
147-158: ⚡ Quick winAvoid hardcoding one specific default app bundle ID in this behavior test.
Using a literal default ID makes this test fail on harmless default-list updates. Assert against
DEFAULT_IGNORED_APP_BUNDLE_IDinstead.Proposed test hardening
- // Default apps are initially ignored - XCTAssertTrue(PreferencesManager.isAppIgnored("pl.maketheweb.cleanshotx")) + // At least one default app should be initially ignored + XCTAssertTrue( + DEFAULT_IGNORED_APP_BUNDLE_ID.contains { PreferencesManager.isAppIgnored($0) } + )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@SwiftShiftTests/PreferencesManagerTests.swift` around lines 147 - 158, The testIsAppIgnored_checksBothLists test is hardcoding a specific default app bundle ID ("pl.maketheweb.cleanshotx") in the assertion which makes the test brittle to default list updates. Replace the hardcoded bundle ID string in the XCTAssertTrue call with a reference to the DEFAULT_IGNORED_APP_BUNDLE_ID constant instead, ensuring the test validates the behavior of checking default ignored apps without depending on a specific app remaining in that list.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/build.yml:
- Line 1: The workflow file is missing an explicit permissions block at the top
level, which causes it to use broader default GITHUB_TOKEN scopes than
necessary. Add a permissions block immediately after the name field in the Build
& Test workflow that specifies only the minimum required permissions needed by
the workflow's jobs. This should follow GitHub's least-privilege principle and
restrict token access to only what is necessary for the workflow to function.
- Line 24: The actions/checkout action at line 24 uses a tag-based reference
(v4) instead of a pinned commit SHA, and does not disable credential
persistence. Replace the tag reference with a specific commit SHA (e.g.,
actions/checkout@<full-commit-hash>) and add a with section that sets
persist-credentials to false to reduce supply-chain and token exposure risks.
Apply this same fix consistently to the actions/checkout references at line 18
in build.yml and in www.yml as mentioned in the comment.
In `@Swift` Shift.xcodeproj/project.pbxproj:
- Around line 595-630: The SwiftShiftTests target has a higher deployment target
than the app, blocking tests from running on supported environments. Lower the
MACOSX_DEPLOYMENT_TARGET setting from 14.0 to 13.0 in both the Release
configuration (291EF055A6868417DA4ECDEC) and Debug configuration
(47FCE1967DC1C8CDFFAFC909) for SwiftShiftTests to match the app target
deployment version.
- Line 94: The Foundation.framework file reference F8B92CDB5F568BDAA9756F45 has
a hard-coded path that includes a specific SDK version (MacOSX15.0.sdk), which
breaks across machines with different SDK installations. Replace the hard-coded
SDK version path with a relative reference or use Xcode build variables. Either
remove the explicit path to let Xcode resolve the framework from the current
SDK, or use dynamic build variables like $(SDKROOT) in the path to make it
adaptive to the developer's installed Xcode version.
In `@Swift` Shift.xcodeproj/xcshareddata/xcschemes/Swift Shift.xcscheme:
- Around line 31-35: The BlueprintIdentifier value for the SwiftShiftTests
target in the scheme file does not match the actual target ID defined in the
project.pbxproj file, causing test resolution failures. Locate the correct
BlueprintIdentifier for the SwiftShiftTests target by checking the
project.pbxproj file, then update the BlueprintIdentifier attribute in the
BuildableReference elements for SwiftShiftTests in both the BuildActionEntry
section and the TestableReference section of the scheme to use the correct
matching target ID.
In `@SwiftShiftTests/PreferencesManagerTests.swift`:
- Around line 192-206: The testMigration_addsDefaultAppsWhenMissing test only
validates that the custom app and migration flag are present, but it does not
actually verify that the default apps were merged during migration. Add
assertions after retrieving apps from PreferencesManager.getUserIgnoredApps() to
check that the returned apps collection contains the expected default app
identifiers (in addition to the custom "com.example.only" entry). This ensures
the migration logic is truly adding defaults instead of just setting a flag.
---
Nitpick comments:
In `@SwiftShiftTests/PreferencesManagerTests.swift`:
- Around line 147-158: The testIsAppIgnored_checksBothLists test is hardcoding a
specific default app bundle ID ("pl.maketheweb.cleanshotx") in the assertion
which makes the test brittle to default list updates. Replace the hardcoded
bundle ID string in the XCTAssertTrue call with a reference to the
DEFAULT_IGNORED_APP_BUNDLE_ID constant instead, ensuring the test validates the
behavior of checking default ignored apps without depending on a specific app
remaining in that list.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 78dafc08-352f-45a9-987a-b3f54c04bf57
📒 Files selected for processing (7)
.github/workflows/build.ymlMakefileSwift Shift.xcodeproj/project.pbxprojSwift Shift.xcodeproj/xcshareddata/xcschemes/Swift Shift.xcschemeSwiftShiftTests/KeyboardShortcutTests.swiftSwiftShiftTests/PreferencesManagerTests.swiftSwiftShiftTests/WindowManagerTests.swift
| @@ -1,4 +1,4 @@ | |||
| name: Build | |||
| name: Build & Test | |||
There was a problem hiding this comment.
Set explicit least-privilege token permissions for this workflow.
Without a permissions block, the workflow uses broader default GITHUB_TOKEN scopes than needed.
🔧 Suggested fix
name: Build & Test
+
+permissions:
+ contents: read📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| name: Build & Test | |
| name: Build & Test | |
| permissions: | |
| contents: read |
🧰 Tools
🪛 zizmor (1.25.2)
[warning] 1-34: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/build.yml at line 1, The workflow file is missing an
explicit permissions block at the top level, which causes it to use broader
default GITHUB_TOKEN scopes than necessary. Add a permissions block immediately
after the name field in the Build & Test workflow that specifies only the
minimum required permissions needed by the workflow's jobs. This should follow
GitHub's least-privilege principle and restrict token access to only what is
necessary for the workflow to function.
Source: Linters/SAST tools
| test: | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
What is the latest stable commit SHA for actions/checkout v4, from the official GitHub repository releases/tags?
💡 Result:
As of June 20, 2026, the latest stable tag for actions/checkout in the v4 series is v4.3.1. The official commit SHA for this tag is 34e114876b6d76451613b52a51d8975971439246 [1]. Please note that while the v4 branch continues to receive maintenance, newer versions of the action (such as v6) are also available [2][3]. Users are encouraged to refer to the official actions/checkout GitHub releases page for the most current information [2].
Citations:
- 1: https://redirect.github.com/actions/checkout/releases/tag/v4.3.1
- 2: https://github.com/actions/checkout/?tab=readme-ov-file
- 3: https://github.com/actions/checkout/blob/main/CHANGELOG.md
🏁 Script executed:
# Check the build.yml file around line 24
cat -n .github/workflows/build.yml | sed -n '15,35p'Repository: pablopunk/SwiftShift
Length of output: 749
🏁 Script executed:
# Search for all action usages in the workflows directory to assess scope
rg "uses:" .github/workflows/ -A 1 -B 1Repository: pablopunk/SwiftShift
Length of output: 750
Pin actions/checkout to a commit SHA and disable credential persistence.
Using tag-based action refs (e.g., v4) instead of commit SHAs and relying on default credential persistence increases supply-chain and token exposure risk.
🔧 Suggested fix
- - uses: actions/checkout@v4
+ - uses: actions/checkout@34e114876b6d76451613b52a51d8975971439246
+ with:
+ persist-credentials: falseNote: This same issue exists at line 18 of build.yml and in www.yml. Apply the fix consistently across all workflow files.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - uses: actions/checkout@v4 | |
| - uses: actions/checkout@34e114876b6d76451613b52a51d8975971439246 | |
| with: | |
| persist-credentials: false |
🧰 Tools
🪛 zizmor (1.25.2)
[warning] 24-24: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 24-24: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/build.yml at line 24, The actions/checkout action at line
24 uses a tag-based reference (v4) instead of a pinned commit SHA, and does not
disable credential persistence. Replace the tag reference with a specific commit
SHA (e.g., actions/checkout@<full-commit-hash>) and add a with section that sets
persist-credentials to false to reduce supply-chain and token exposure risks.
Apply this same fix consistently to the actions/checkout references at line 18
in build.yml and in www.yml as mentioned in the comment.
Source: Linters/SAST tools
| E2D8CFB82B3C3B9B00EBB047 /* PermissionsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionsManager.swift; sourceTree = "<group>"; }; | ||
| E2E6F5E92B3EF03C005B0D96 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; }; | ||
| F400D7AF72C65A047C5C9D19 /* Constants.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Constants.swift; path = "Swift Shift/src/Constants.swift"; sourceTree = "<group>"; }; | ||
| F8B92CDB5F568BDAA9756F45 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify whether SDK-version-pinned system framework paths exist in pbxproj.
rg -n 'MacOSX[0-9]+\.[0-9]+\.sdk/.*/Foundation\.framework' "Swift Shift.xcodeproj/project.pbxproj"Repository: pablopunk/SwiftShift
Length of output: 358
🏁 Script executed:
cat -n "Swift Shift.xcodeproj/project.pbxproj" | sed -n '90,120p'Repository: pablopunk/SwiftShift
Length of output: 2208
🏁 Script executed:
# Search for all SDK-version-pinned framework paths in the pbxproj
rg -n 'MacOSX[0-9]+\.[0-9]+\.sdk.*\.framework' "Swift Shift.xcodeproj/project.pbxproj"Repository: pablopunk/SwiftShift
Length of output: 358
Hard-coded SDK path for Foundation is brittle across Xcode versions.
The file reference at line 94 points to a versioned SDK path (MacOSX15.0.sdk) under DEVELOPER_DIR. This can break project loading/builds on machines with different installed SDK versions.
🔧 Suggested fix
- F8B92CDB5F568BDAA9756F45 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
+ F8B92CDB5F568BDAA9756F45 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Swift` Shift.xcodeproj/project.pbxproj at line 94, The Foundation.framework
file reference F8B92CDB5F568BDAA9756F45 has a hard-coded path that includes a
specific SDK version (MacOSX15.0.sdk), which breaks across machines with
different SDK installations. Replace the hard-coded SDK version path with a
relative reference or use Xcode build variables. Either remove the explicit path
to let Xcode resolve the framework from the current SDK, or use dynamic build
variables like $(SDKROOT) in the path to make it adaptive to the developer's
installed Xcode version.
| 291EF055A6868417DA4ECDEC /* Release */ = { | ||
| isa = XCBuildConfiguration; | ||
| buildSettings = { | ||
| BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| GENERATE_INFOPLIST_FILE = YES; | ||
| INFOPLIST_FILE = ""; | ||
| LD_RUNPATH_SEARCH_PATHS = ( | ||
| "$(inherited)", | ||
| "@loader_path/../Frameworks", | ||
| ); | ||
| MACOSX_DEPLOYMENT_TARGET = 14.0; | ||
| PRODUCT_BUNDLE_IDENTIFIER = com.pablopunk.SwiftShiftTests; | ||
| PRODUCT_NAME = SwiftShiftTests; | ||
| SWIFT_VERSION = 5.0; | ||
| TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Swift Shift.app/Contents/MacOS/Swift Shift"; | ||
| }; | ||
| name = Release; | ||
| }; | ||
| 47FCE1967DC1C8CDFFAFC909 /* Debug */ = { | ||
| isa = XCBuildConfiguration; | ||
| buildSettings = { | ||
| BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| GENERATE_INFOPLIST_FILE = YES; | ||
| INFOPLIST_FILE = ""; | ||
| LD_RUNPATH_SEARCH_PATHS = ( | ||
| "$(inherited)", | ||
| "@loader_path/../Frameworks", | ||
| ); | ||
| MACOSX_DEPLOYMENT_TARGET = 14.0; | ||
| PRODUCT_BUNDLE_IDENTIFIER = com.pablopunk.SwiftShiftTests; | ||
| PRODUCT_NAME = SwiftShiftTests; | ||
| SWIFT_VERSION = 5.0; | ||
| TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Swift Shift Dev.app/Contents/MacOS/Swift Shift Dev"; | ||
| }; | ||
| name = Debug; | ||
| }; |
There was a problem hiding this comment.
Test target deployment target is higher than the app target.
SwiftShiftTests is set to macOS 14.0 while the app target is 13.0. This blocks running tests on environments that can still build/run the app.
🔧 Suggested fix
- MACOSX_DEPLOYMENT_TARGET = 14.0;
+ MACOSX_DEPLOYMENT_TARGET = 13.0;(Apply in both SwiftShiftTests Debug and Release build settings.)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 291EF055A6868417DA4ECDEC /* Release */ = { | |
| isa = XCBuildConfiguration; | |
| buildSettings = { | |
| BUNDLE_LOADER = "$(TEST_HOST)"; | |
| GENERATE_INFOPLIST_FILE = YES; | |
| INFOPLIST_FILE = ""; | |
| LD_RUNPATH_SEARCH_PATHS = ( | |
| "$(inherited)", | |
| "@loader_path/../Frameworks", | |
| ); | |
| MACOSX_DEPLOYMENT_TARGET = 14.0; | |
| PRODUCT_BUNDLE_IDENTIFIER = com.pablopunk.SwiftShiftTests; | |
| PRODUCT_NAME = SwiftShiftTests; | |
| SWIFT_VERSION = 5.0; | |
| TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Swift Shift.app/Contents/MacOS/Swift Shift"; | |
| }; | |
| name = Release; | |
| }; | |
| 47FCE1967DC1C8CDFFAFC909 /* Debug */ = { | |
| isa = XCBuildConfiguration; | |
| buildSettings = { | |
| BUNDLE_LOADER = "$(TEST_HOST)"; | |
| GENERATE_INFOPLIST_FILE = YES; | |
| INFOPLIST_FILE = ""; | |
| LD_RUNPATH_SEARCH_PATHS = ( | |
| "$(inherited)", | |
| "@loader_path/../Frameworks", | |
| ); | |
| MACOSX_DEPLOYMENT_TARGET = 14.0; | |
| PRODUCT_BUNDLE_IDENTIFIER = com.pablopunk.SwiftShiftTests; | |
| PRODUCT_NAME = SwiftShiftTests; | |
| SWIFT_VERSION = 5.0; | |
| TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Swift Shift Dev.app/Contents/MacOS/Swift Shift Dev"; | |
| }; | |
| name = Debug; | |
| }; | |
| 291EF055A6868417DA4ECDEC /* Release */ = { | |
| isa = XCBuildConfiguration; | |
| buildSettings = { | |
| BUNDLE_LOADER = "$(TEST_HOST)"; | |
| GENERATE_INFOPLIST_FILE = YES; | |
| INFOPLIST_FILE = ""; | |
| LD_RUNPATH_SEARCH_PATHS = ( | |
| "$(inherited)", | |
| "`@loader_path/`../Frameworks", | |
| ); | |
| MACOSX_DEPLOYMENT_TARGET = 13.0; | |
| PRODUCT_BUNDLE_IDENTIFIER = com.pablopunk.SwiftShiftTests; | |
| PRODUCT_NAME = SwiftShiftTests; | |
| SWIFT_VERSION = 5.0; | |
| TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Swift Shift.app/Contents/MacOS/Swift Shift"; | |
| }; | |
| name = Release; | |
| }; | |
| 47FCE1967DC1C8CDFFAFC909 /* Debug */ = { | |
| isa = XCBuildConfiguration; | |
| buildSettings = { | |
| BUNDLE_LOADER = "$(TEST_HOST)"; | |
| GENERATE_INFOPLIST_FILE = YES; | |
| INFOPLIST_FILE = ""; | |
| LD_RUNPATH_SEARCH_PATHS = ( | |
| "$(inherited)", | |
| "`@loader_path/`../Frameworks", | |
| ); | |
| MACOSX_DEPLOYMENT_TARGET = 13.0; | |
| PRODUCT_BUNDLE_IDENTIFIER = com.pablopunk.SwiftShiftTests; | |
| PRODUCT_NAME = SwiftShiftTests; | |
| SWIFT_VERSION = 5.0; | |
| TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Swift Shift Dev.app/Contents/MacOS/Swift Shift Dev"; | |
| }; | |
| name = Debug; | |
| }; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Swift` Shift.xcodeproj/project.pbxproj around lines 595 - 630, The
SwiftShiftTests target has a higher deployment target than the app, blocking
tests from running on supported environments. Lower the MACOSX_DEPLOYMENT_TARGET
setting from 14.0 to 13.0 in both the Release configuration
(291EF055A6868417DA4ECDEC) and Debug configuration (47FCE1967DC1C8CDFFAFC909)
for SwiftShiftTests to match the app target deployment version.
| BlueprintIdentifier = "D76A70D72EB4AAB358AE0D75" | ||
| BuildableName = "SwiftShiftTests.xctest" | ||
| BlueprintName = "SwiftShiftTests" | ||
| ReferencedContainer = "container:Swift Shift.xcodeproj"> | ||
| </BuildableReference> |
There was a problem hiding this comment.
Scheme references a non-existent test target ID.
The BlueprintIdentifier for SwiftShiftTests in the scheme does not match the target ID defined in Swift Shift.xcodeproj/project.pbxproj, so xcodebuild test can fail to resolve the test bundle.
🔧 Suggested fix
- BlueprintIdentifier = "D76A70D72EB4AAB358AE0D75"
+ BlueprintIdentifier = "4F0E66367D37633ED8A08262"(Apply to both BuildActionEntry and TestableReference.)
Also applies to: 51-55
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Swift` Shift.xcodeproj/xcshareddata/xcschemes/Swift Shift.xcscheme around
lines 31 - 35, The BlueprintIdentifier value for the SwiftShiftTests target in
the scheme file does not match the actual target ID defined in the
project.pbxproj file, causing test resolution failures. Locate the correct
BlueprintIdentifier for the SwiftShiftTests target by checking the
project.pbxproj file, then update the BlueprintIdentifier attribute in the
BuildableReference elements for SwiftShiftTests in both the BuildActionEntry
section and the TestableReference section of the scheme to use the correct
matching target ID.
| func testMigration_addsDefaultAppsWhenMissing() { | ||
| // Reset migration flag | ||
| UserDefaults.standard.removeObject(forKey: PreferenceKey.didMigrateDefaultIgnoredApps.rawValue) | ||
| PreferencesManager.invalidateIgnoredAppsCache() | ||
|
|
||
| // Set a custom list without defaults | ||
| PreferencesManager.setUserIgnoredApps(["com.example.only"]) | ||
|
|
||
| // First call to getUserIgnoredApps should trigger migration | ||
| let apps = PreferencesManager.getUserIgnoredApps() | ||
| XCTAssertTrue(apps.contains("com.example.only")) | ||
|
|
||
| // After migration, the migration flag should be set | ||
| XCTAssertTrue(UserDefaults.standard.bool(forKey: PreferenceKey.didMigrateDefaultIgnoredApps.rawValue)) | ||
| } |
There was a problem hiding this comment.
Assert the migration effect, not just the migration flag.
testMigration_addsDefaultAppsWhenMissing can pass even if defaults are never merged, because it only checks the custom app and migration flag. Validate that migrated defaults are present in apps.
Proposed test fix
let apps = PreferencesManager.getUserIgnoredApps()
XCTAssertTrue(apps.contains("com.example.only"))
+ XCTAssertTrue(
+ DEFAULT_IGNORED_APP_BUNDLE_ID.allSatisfy { apps.contains($0) },
+ "Migration should merge all default ignored apps into the existing user list"
+ )
// After migration, the migration flag should be set
XCTAssertTrue(UserDefaults.standard.bool(forKey: PreferenceKey.didMigrateDefaultIgnoredApps.rawValue))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@SwiftShiftTests/PreferencesManagerTests.swift` around lines 192 - 206, The
testMigration_addsDefaultAppsWhenMissing test only validates that the custom app
and migration flag are present, but it does not actually verify that the default
apps were merged during migration. Add assertions after retrieving apps from
PreferencesManager.getUserIgnoredApps() to check that the returned apps
collection contains the expected default app identifiers (in addition to the
custom "com.example.only" entry). This ensures the migration logic is truly
adding defaults instead of just setting a flag.
Closes #173
What
Adds the project's first test target with 49 unit tests covering the three most testable modules.
Test suites
Changes
SwiftShiftTestsunit test bundle with@testable import Swift_Shift_Devmake testtarget added to Makefiletestjob on PRs and main pushesNot in scope
MouseTracker,ShortcutsManager,CGEventSupervisor— tightly coupled to system event taps/AXUIElement, need refactoring for testabilitySummary by CodeRabbit
Chores
Tests