Skip to content

Run the tests on iOS and add the iOS CI job #373 - #402

Merged
Kaaveh merged 1 commit into
kmpfrom
373-ios-tests-ci
Nov 1, 2026
Merged

Kaaveh merged 1 commit into
kmpfrom
373-ios-tests-ci

Conversation

@Kaaveh

@Kaaveh Kaaveh commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Closes #373 (part of #356 Phase 2).

What

  • MockK out, fakes in: MockK doesn't run on Kotlin/Native, so the 10 MockK tests (6 use cases, MarketRepositoryImplTest, 3 ViewModel tests) move to commonTest.
    • FakeMarketRepository (core:testing) is now configurable per method and records calls. Its defaults are unchanged.
    • The repository test uses FakeMarketsApi/FakeMarketDao and real HttpResponses from ktor's MockEngine (new test-only dep ktor-client-mock).
    • MockK and the unused mockk-android leave the catalog.
  • Kotest on iOS: composenews.kmp.library applies KSP and the io.kotest plugin in modules with a src/commonTest, so iosSimulatorArm64Test finds every spec.
  • DAO tests on both platforms: the six checks live once in commonTest (MarketDaoChecks). The Robolectric MarketDaoTest and the iOS MarketDaoSpec run them, each with its own inMemoryMarketDatabase() actual (AndroidSQLiteDriver / BundledSQLiteDriver).
  • Swift Testing: a new iosAppTests bundle with three ScreenModel tests: initial state, events reaching the ViewModel, and dropping the model clearing it. It's hosted by the app and doesn't link a second copy of Shared.
  • MarketDetailScreenTest (androidTest) builds the real use cases on the fake, so GetMarketChartUseCase, GetMarketDetailUseCase and ToggleFavoriteMarketListUseCase are final again.
  • CI: a new ios job on macos-latest (60 min timeout). It selects the newest installed Xcode, picks the newest iPhone simulator (failing clearly if there's none), then runs :shared:linkDebugFrameworkIosSimulatorArm64 iosSimulatorArm64Test and xcodebuild test. The Android job is unchanged.

Verified locally

  • ./gradlew test lintKotlin detektAll linkDebugTestIosSimulatorArm64 :konsist:test and the app / marketdetail:ui androidTest compiles pass.
  • xcodebuild build-for-testing for a generic simulator succeeds.

Not run locally

This Mac has no iOS Simulator runtime, so the Kotlin tests on iOS, the Swift tests and the new CI steps run for the first time in this PR's ios job.

🤖 Generated with Claude Code

- MockK doesn't run on Kotlin/Native, so the use-case, repository and
  ViewModel tests move to commonTest on hand-written fakes: a configurable
  FakeMarketRepository in core:testing, FakeMarketsApi/FakeMarketDao next to
  the repository test, real HttpResponses from ktor's MockEngine. MockK is
  dropped from the catalog
- Kotest on Native: the KMP convention applies KSP and the io.kotest plugin
  in modules with a commonTest, so iosSimulatorArm64Test runs every spec
- DAO checks live once in commonTest (MarketDaoChecks), run by the
  Robolectric MarketDaoTest and the iOS MarketDaoSpec, each with its own
  inMemoryMarketDatabase() actual (BundledSQLiteDriver on iOS)
- iosAppTests: Swift Testing tests on ScreenModel, in a hosted test bundle
  that doesn't link a second copy of Shared
- MarketDetailScreenTest builds the real use cases on the fake, so they're
  final again
- CI: an ios job on macOS that selects the newest Xcode, picks the newest
  iPhone simulator, runs iosSimulatorArm64Test and xcodebuild test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Warnings
⚠️ Please consider breaking up this pull request.
⚠️ Please add labels to this PR.
Messages
📖 Thanks @Kaaveh!

Generated by 🚫 Danger Kotlin against e1d1007

@Kaaveh
Kaaveh merged commit 0585f4a into kmp Nov 1, 2026
4 checks passed
@Kaaveh
Kaaveh deleted the 373-ios-tests-ci branch November 1, 2026 07:06
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.

iOS tests and CI

1 participant