Skip to content

DashWalletTests cannot build, so new unit tests document intent instead of guarding it #1127

Closed

Description

@llbartekll

What

DashWalletTests cannot be compiled as a target. Its files are split across two app modules:

import files
@testable import dashwallet 7
@testable import dashpay 26

No scheme builds both modules, so the target never type-checks as a whole. Every test in it is unverified — not merely unrun, but never compiled.

Raised during review of #1118, where two policy types (RuntimeRefreshPolicy, RuntimeReadinessPolicy) were extracted specifically so the refresh-elision and readiness decisions could be regression-tested. The tests exist and read correctly, but nothing compiles them, so they document intent rather than guard it. The userHasBalance contract change in that PR sits in the dashwallet-importing minority and is in the same position.

Why the obvious shortcut does not work as-is

The suggestion in review was a small separate test target compiling only those two value types plus their tests. That is not a drop-in today:

  • RuntimeRefreshPolicy.shouldSkipRebuild takes SwiftDashSDKWalletRuntime.RefreshTrigger, an enum nested inside the runtime class. Compiling the policy therefore pulls in the whole ~900-line runtime file and everything it touches: the host, the Platform sync coordinator, the lifecycle transition state.
  • RuntimeReadinessPolicy takes Network, which comes from SwiftDashSDK. Even a minimal target needs the SDK package.

So "dependency-free value types" is not quite the state of the code.

Options

  1. Split the test target in two, one per app module, matching the split that already exists in the files. Largest change, fixes every test at once.
  2. Lift RefreshTrigger out of the runtime class to a top-level enum, then a small target can compile both policies plus their tests against SwiftDashSDK alone. Narrow, and makes the extracted policies genuinely testable, which was the point of extracting them.
  3. Leave as is and stop adding tests to the target, so nobody mistakes them for coverage.

Option 2 is the cheapest thing that turns the existing policy tests into real coverage.

Scope note

Pre-existing and not introduced by #1118. That PR states the situation plainly in its description rather than implying the tests run.

Activity

  1. llbartekll commented on Oct 23, 2026

    @llbartekll
    ContributorAuthor

    Resolved by #1213 (revived DashWalletTests against the dashwallet-dashpay scheme; the real blocker was the Release TestAction without ENABLE_TESTABILITY, not the mixed imports) and #1217 (ported the harness-only tests back into the target). The suite runs on every PR via .github/workflows/unit-tests.yml, so the policy tests from #1118 are compiled and executed, not just documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions