Add iOS Unit Test Suite - 91 Tests#32
Merged
Merged
Conversation
…lient, models, Keychain, ImageCache
Jing-yilin
commented
Feb 28, 2026
Contributor
Author
Jing-yilin
left a comment
There was a problem hiding this comment.
Codex Review
[Low] testLoadCategoriesSkipsIfAlreadyLoaded does not observe the code path it is meant to protect
DiscoverViewModel.loadCategories() calls fetchCategories(), but this test snapshots mock.fetchCampaignsCalls.count instead. Because MockAPIClient does not record category fetches, the assertion still passes even if loadCategories() regresses to hitting the categories endpoint on every call. In practice, the suite is not actually covering the "skip refetch when already loaded" behavior this test claims to verify.
Refs: ios/KickWatch/Tests/DiscoverViewModelTests.swift:159, ios/KickWatch/Tests/MockAPIClient.swift:38
Validation
cd backend && go test ./...cd ios && export DEVELOPMENT_TEAM=7Q28CBP3S5 && xcodegen generatecd ios && xcodebuild -project KickWatch.xcodeproj -scheme KickWatch -destination 'platform=iOS Simulator,name=iPhone 17' test- Result: backend suite passed; iOS suite passed with 91 tests on February 28, 2026.
Reviewed by Codex
testLoadCategoriesSkipsIfAlreadyLoaded was checking fetchCampaignsCalls.count instead of fetchCategories calls, so the test would pass even if the skip-refetch logic broke. - Add fetchCategoriesCalled flag to MockAPIClient - Update test to check fetchCategoriesCalled instead of fetchCampaignsCalls - Set flag in fetchCategories() implementation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a comprehensive iOS unit test suite covering core functionality across ViewModels, APIClient, models, Keychain, and ImageCache.
Test Coverage
Additional Changes
This branch includes several backend improvements and features:
POST /api/admin/backfill)backers_countfieldTest Plan
🤖 Generated with Claude Code