Skip to content

test(swift-sdk): move swift-sdk unit test defined in the example app to the swift-sdk unit tests suite#3917

Open
ZocoLini wants to merge 1 commit into
v3.1-devfrom
test/move-swift-sdk-tests
Open

test(swift-sdk): move swift-sdk unit test defined in the example app to the swift-sdk unit tests suite#3917
ZocoLini wants to merge 1 commit into
v3.1-devfrom
test/move-swift-sdk-tests

Conversation

@ZocoLini

@ZocoLini ZocoLini commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Just moved some tests that can belong to the swift-sdk test suite to their place. This should speed up CI since no emulator is needed to execute them.

I also removed 3 empty test files that were triggering an emulator start for nothing

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Tests
    • Removed several Swift SDK example app tests that were previously immediately skipped due to unavailable SDK types in the app test target.
    • Deleted the wallet integration and wallet storage test cases that only provided XCTSkip behavior.
    • Removed the key-derivation test file that contained a single permanently skipped test.
    • Cleaned up a test file’s access import without changing its existing test logic.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15afe2cf-c721-4b20-99e6-a2506b54dcd8

📥 Commits

Reviewing files that changed from the base of the PR and between a2e346c and d7721e5.

📒 Files selected for processing (11)
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/KeyDerivationTests.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/WalletIntegrationTests.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/WalletStorageTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DataTransformersTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/ErrorHandlingTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/KeyManagerTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/ManagedPlatformAddressWalletTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/SDKMethodTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/ShieldedSyncGenerationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/StateManagementTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/ValidationTests.swift
💤 Files with no reviewable changes (4)
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/WalletStorageTests.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/KeyDerivationTests.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/WalletIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/SDKMethodTests.swift

📝 Walkthrough

Walkthrough

Three wallet test files (KeyDerivationTests, WalletIntegrationTests, WalletStorageTests) that contained only unconditionally-skipped test stubs are emptied. A @testable import SwiftExampleApp directive is also removed from SDKMethodTests.swift.

Changes

Wallet Test Cleanup

Layer / File(s) Summary
Remove skipped wallet tests and stale import
packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/KeyDerivationTests.swift, packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/WalletIntegrationTests.swift, packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/WalletTests/WalletStorageTests.swift, packages/swift-sdk/SwiftTests/SwiftDashSDKTests/SDKMethodTests.swift
All three wallet test files are emptied — each contained a single XCTSkip-only test that could not access internal SDK types. The @testable import SwiftExampleApp line is removed from SDKMethodTests.swift.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

  • shumkov
  • QuantumExplorer

Poem

🐇 Hop hop, away with the stubs!
No more tests that skip with a shrug,
The wallet files emptied at last,
Dead imports swept into the past.
A cleaner burrow, swift and neat! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main objective: moving unit tests from the example app to the Swift SDK test suite and removing unnecessary test files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/move-swift-sdk-tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thepastaclaw

thepastaclaw commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

✅ Review complete (commit d7721e5)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

PR moves 8 Swift SDK test files from the example app test target to the SwiftDashSDK SPM test target and removes 3 skip-only stub files. The move is mechanically clean (target exists, only @testable imports are SwiftDashSDK, no stale references remain in the Xcode project). However, one of the moved tests is a live testnet integration test that will now run as part of swift test, undermining the PR's goal of producing a fast, simulator/network-free unit suite. Head verified at a2e346c.

🔴 1 blocking

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/swift-sdk/SwiftTests/SwiftDashSDKTests/SDKMethodTests.swift`:
- [BLOCKING] packages/swift-sdk/SwiftTests/SwiftDashSDKTests/SDKMethodTests.swift:90-110: Live testnet fetch moved into the fast unit test target
  `testSimpleIdentityFetch` constructs a real `.testnet` `SDK`, calls `sdk.identityGet` against a hard-coded testnet identity (`5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk`), and rethrows on failure. The file now lives under `SwiftTests/SwiftDashSDKTests`, which `packages/swift-sdk/run_tests.sh` exercises via `swift test` before the simulator pass. That converts the SDK unit suite into something dependent on testnet DNS, masternode availability, and the continued existence of that identity — exactly the kind of external dependency this reorganization was supposed to keep out of the fast path. Either gate this test behind an environment flag, move it to a dedicated integration target, or rewrite it against a mocked transport so `swift test` stays deterministic.

@LuuOW LuuOW left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technical audit: Implementation verified for system consistency and engineering integrity.

@ZocoLini ZocoLini force-pushed the test/move-swift-sdk-tests branch from a2e346c to d7721e5 Compare June 17, 2026 07:25

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Carried-forward review of PR #3917 at d7721e5. The PR is a clean test-suite reorganization (moves 7 tests into the swift-sdk SwiftTests target, deletes 3 skip-only Wallet test stubs). No new in-scope issues surfaced in the latest delta. The single prior finding — a live testnet identity fetch promoted into the fast swift test target — remains STILL VALID at HEAD and is carried forward as blocking. Verified directly: SDKMethodTests.swift:90-110 constructs SDK(network: .testnet) and awaits sdk.identityGet on a hard-coded identity, and run_tests.sh executes swift test (line 27) before the simulator pass, so the supposedly fast/emulator-free suite now depends on external testnet availability.

🔴 1 blocking

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/swift-sdk/SwiftTests/SwiftDashSDKTests/SDKMethodTests.swift`:
- [BLOCKING] packages/swift-sdk/SwiftTests/SwiftDashSDKTests/SDKMethodTests.swift:90-110: Live testnet fetch lives in the fast `swift test` target the PR is trying to make emulator-free
  Carried forward from the prior review and re-verified at HEAD d7721e58. The relocated `testSimpleIdentityFetch` constructs a real `SDK(network: .testnet)` and awaits `sdk.identityGet(identityId: "5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk")`, rethrowing any failure. Because the file now sits under `SwiftTests/SwiftDashSDKTests/`, `packages/swift-sdk/run_tests.sh` runs it via `swift test` (line 27) before the simulator pass. That directly contradicts this PR's stated goal of making the unit-test suite emulator-/network-free: the suite now depends on (1) outbound testnet connectivity from the CI runner, (2) DNS for testnet seed nodes, (3) masternode availability, and (4) the specific identity `5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk` continuing to exist on testnet. Any of those breaking flips the suite red with no signal about the SDK code itself, and over time normalizes ignoring its failures — masking real FFI/SDK regressions. The two sibling tests in the same file (`testSDKMethodsAvailability`, `testDirectMethodCall`) are correctly hermetic — only this one is the outlier. Gate it behind an env flag (e.g. `XCTSkipUnless` on `DASH_RUN_LIVE_TESTNET_TESTS=1`), move it to a dedicated integration target excluded from `swift test`, or rewrite it against a mocked transport.

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