MistDemo: tier-1 unit tests for pure config + command helpers#323
Conversation
Adds tests that don't require live CloudKit access — covers the cheapest slice of the patch-coverage gap on PR #298 (codecov/patch: 13%). New test files (all @testable, no network): - Configuration/AuthTokenConfigTests.swift — memberwise init + parsed init via InMemoryProvider, including the missing/empty api.token error path - Configuration/UploadAssetConfigTests.swift — memberwise init for every field - Configuration/TestIntegrationConfigTests.swift — defaults + custom values - Configuration/TestPrivateConfigTests.swift — defaults + private-DB pinning - Commands/QueryCommand/QueryCommandTests+ParseFilter.swift — full coverage of parseFilter / inferFieldValue / shouldIncludeField / buildComparisonFilter (parameterized over every operator alias and error path) - Commands/CreateCommand/CreateCommandTests+GenerateRecordName.swift — prefix, three-part format, suffix range, distinctness across 200 calls - Commands/DemoErrorsRunnerOutputTests.swift — describe(_:) placeholder + echo Source changes are minimal seams that mirror the existing DeleteCommand.mapConflict pattern (internal-static for testability): - QueryCommand: filter parsing helpers extracted into QueryCommand+FilterParsing.swift; private → internal static - CreateCommand.generateRecordName: private → internal 901 MistDemo tests pass; lint + swift-format clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Code Review — PR #323: MistDemo tier-1 unit testsOverall this is a well-structured, purely additive test PR that follows the established Potential Bug:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.0.0-beta.1 #323 +/- ##
=================================================
+ Coverage 67.84% 69.48% +1.63%
=================================================
Files 521 529 +8
Lines 14174 14453 +279
=================================================
+ Hits 9616 10042 +426
+ Misses 4558 4411 -147
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Stacks on top of #298. Closes part of the patch-coverage gap reported by codecov on that PR (currently 13% of new lines hit, target 25.6%). This PR adds purely additive unit tests — no live CloudKit, no network — for the cheapest slice of the gap.
What's tested
AuthTokenConfigTests.swiftInMemoryProvider, including the missing/emptyapi.tokenerror path (32 missed lines on PR #298)UploadAssetConfigTests.swiftTestIntegrationConfigTests.swiftTestPrivateConfigTests.swiftQueryCommandTests+ParseFilter.swiftparseFilter/inferFieldValue/shouldIncludeField/buildComparisonFilter— parameterized over every operator alias and every error path (97 missed lines on PR #298, largely the parser)CreateCommandTests+GenerateRecordName.swiftDemoErrorsRunnerOutputTests.swiftdescribe(_:)placeholder + echoSource changes
Minimal seams mirroring the existing
DeleteCommand.mapConflictpattern (internal-static for testability — no behavior change):QueryCommand: filter parsing helpers extracted intoQueryCommand+FilterParsing.swift;private→internal staticCreateCommand.generateRecordName:private→internalWhat's NOT in this PR
Command bodies that actually call
CloudKitService(most of the remaining gap —DemoErrorsRunner,UploadAssetCommand,QueryCommand.execute(), etc.) require a refactor to inject a mock service. That work is tracked separately in a follow-up issue.Test plan
cd Examples/MistDemo && swift test— 901 tests, 290 suites passswift testat repo root — 481 tests, 142 suites passScripts/lint.sh— clean (pre-existing periphery warnings only)mise exec -- swift-format lint— clean🤖 Generated with Claude Code
Perform an AI-assisted review on