Skip to content

Split SafeDIToolMockGenerationTests into focused test files#223

Merged
dfed merged 1 commit intomainfrom
dfed/split-mock-generation-tests
Apr 6, 2026
Merged

Split SafeDIToolMockGenerationTests into focused test files#223
dfed merged 1 commit intomainfrom
dfed/split-mock-generation-tests

Conversation

@dfed
Copy link
Copy Markdown
Owner

@dfed dfed commented Apr 6, 2026

Summary

  • Split the 12,650-line SafeDIToolMockGenerationTests.swift into 6 focused files to improve readability and navigability
  • 87 tests moved out, 91 remain in the original file
  • No test logic changed — pure move refactor
  • All 768 tests pass, lint clean

File breakdown

File Tests Lines Description
SafeDIToolMockGenerationTests.swift 91 7,121 Core mock generation (remaining)
SafeDIToolMockGenerationCustomMockTests.swift 30 1,953 User-written mock coexistence
SafeDIToolMockGenerationDefaultValueTests.swift 24 1,487 Default-valued parameter bubbling
SafeDIToolMockGenerationDisambiguationTests.swift 18 1,582 Parameter label disambiguation
SafeDIToolMockGenerationConfigurationTests.swift 12 499 generateMock flag, conditional compilation, attributes
SafeDIToolMockGenerationErrorTests.swift 11 (+3) 513 Error/warning behavior (existing file, 3 tests added)

Tests moved to SafeDIToolMockGenerationErrorTests.swift

  • mock_misconfiguredMockMethodEmitsComment
  • mock_mockMethodMissingDependencyEmitsComment
  • mock_parseErrorWritesErrorStubToMockOutputs

Tests moved to SafeDIToolMockGenerationCustomMockTests.swift

  • mock_generatedWithCustomMockCallThrough_whenTypeHasExistingMockMethodAndCustomMockName
  • mock_generatedWhenTypeHasExistingMockMethodWithCustomMockNameAndGenerateMock
  • mock_generatedWhenTypeHasNonStaticMockMethod
  • mock_usesExistingMockMethodInChildConstruction
  • mock_existingMockMethodCoexistsWithNonMockChildren
  • mock_existingMockMethodInDeepTree
  • mock_existingMockMethodOnExtensionBasedType
  • mock_existingMockMethodOnExtensionBasedTypeWithReversedSourceOrder
  • mock_existingMockMethodWithMultipleDependencies
  • mock_existingMockMethodWithReversedParameterOrder
  • mock_existingMockMethodSkipsGenerationForTypeButGeneratesForParent
  • mock_defaultValuedParameterOnTypeWithExistingMock
  • mock_uncoveredDependencyEvaluatedBeforePassingToUserMock
  • mock_typeWithUserMockAndOnlyDefaultValuedParamsGeneratesCallThrough_whenCustomMockNameIsSet
  • mock_userMockDependencyIsOptionalParameterWhenFulfillableFromTree
  • mock_userMockDependencyBecomesRequiredParameterWhenNotFulfillable
  • mock_userMockOnlyIfAvailableDependencyUsesNilDefaultWhenNotFulfillable
  • mock_userMockReturningAdditionalTypeUsedForProtocolProperty
  • mock_userMockReturningAdditionalTypeNotUsedForConcreteProperty
  • mock_extensionUserMockReturningAdditionalTypeUsedForProtocolProperty
  • mock_extensionUserMockReturningAdditionalTypeNotUsedForConcreteProperty
  • mock_generatedMockCallsThroughToHandWrittenMock
  • mock_generatedMockDoesNotExposeInitDefaultsNotOnHandWrittenMock
  • mock_generatedMockExposesHandWrittenMockExtraParams
  • mock_generatedMockCallsThroughToHandWrittenMockForExtension
  • mock_bubblesCustomMockDependencyDefault_whenForwardedPropertyReceivedByChild
  • mock_nearestReceiverDefaultWins_whenMultipleChildrenAtSameDepth
  • mock_forwardedPropertyDefaultBubblesAcrossThreeLevels_eachWithCustomMock
  • mock_doesNotBubbleDefault_whenNoChildHasCustomMock
  • mock_doesNotApplyDefaultFromWrongType_whenSameLabelDifferentTypes

Tests moved to SafeDIToolMockGenerationDefaultValueTests.swift

  • mock_defaultValuedParameterBubblesUpToRootMock
  • mock_defaultValuedParameterUsesOriginalDefaultExpression
  • mock_defaultValuedParameterDoesNotBubbleThroughInstantiator
  • mock_defaultValuedParameterBubblesFromGrandchildToRoot
  • mock_defaultValuedParameterOnRootType
  • mock_defaultValuedParameterDoesNotBubbleThroughSendableInstantiator
  • mock_multipleDefaultValuedParametersFromDifferentChildren
  • mock_defaultValuedParameterWithNilDefault
  • mock_defaultValuedParameterDisambiguatedWhenLabelCollides
  • mock_defaultValuedParameterDoesNotBubbleThroughErasedInstantiator
  • mock_defaultValuedParameterDoesNotBubbleThroughSendableErasedInstantiator
  • mock_defaultValuedParameterWithComplexDefault
  • mock_childDefaultParamDoesNotReEvaluateRootBoundLabel
  • mock_disambiguatedDefaultParamsFromDifferentChildrenDoNotCollideAtRoot
  • mock_defaultValuedParametersFromMultipleLevelsAllAppearAtRoot
  • mock_defaultValuedParameterFromGrandchildStopsAtInstantiatorBoundary
  • mock_defaultValuedClosureParameterStripsEscaping
  • mock_defaultValuedMainActorClosurePreservesMainActor
  • mock_defaultValuedSendableClosurePreservesSendable
  • mock_defaultValuedParamDoesNotSuppressReceivedPropertyBinding
  • mock_forwardedParamDoesNotCollideWithBubbledDefault
  • mock_usesOuterLabel_whenDefaultValuedParameterHasUnderscoreInnerLabel
  • mock_doesNotBubbleDefaultValuedParameter_whenOuterLabelIsUnderscore
  • mock_doesNotBubbleDefaultValuedParameter_whenOnlyLabelIsUnderscore

Tests moved to SafeDIToolMockGenerationDisambiguationTests.swift

  • mock_disambiguatesParameters_whenInstantiatorLabelCollidesWithTypeName
  • mock_disambiguatesParameterLabelsWhenSameInitLabelAppearsTwice
  • mock_disambiguationUsesSimplifiedSuffixWhenUnique
  • mock_disambiguationFallsBackToFullSuffixWhenSimplifiedCollides
  • mock_disambiguatedParamUsedInInstantiatorBuilderFunction
  • mock_disambiguatedInstantiatorBindingUsesDisambiguatedLocalName
  • mock_disambiguatedInstantiatorResolvedBySiblingInNestedBuilder
  • mock_disambiguatedInstantiatorResolvedThroughIntermediateInstantiatorBuilder
  • mock_disambiguatedInstantiatorInDeepNestedBuilderUsesResolvedName
  • mock_disambiguatedAutoclosureEvaluatedInInstantiatorBuilder
  • mock_disambiguatedUncoveredDependencyInNestedInstantiator
  • mock_onlyIfAvailableDisambiguatedSimplifiedUnique
  • mock_closureTypedDefaultDisambiguated
  • mock_disambiguatesAllParameters_whenThreeChildrenShareSameLabel
  • mock_disambiguatedInstantiatorResolvedFromRootInNestedScope
  • mock_postDisambiguationLabelDoesNotCollideWithExistingPropertyLabel
  • mock_aliasedBindingUsesDisambiguatedFulfillingPropertyLabel
  • mock_disambiguationFallsBackToFullSuffixWhenSimplifiedSuffixesCollide

Tests moved to SafeDIToolMockGenerationConfigurationTests.swift

  • mock_respectsMockConditionalCompilationNil
  • mock_respectsCustomMockConditionalCompilation
  • mock_typeWithDependenciesAndNilConditionalCompilation
  • mock_respectsMockAttributes
  • mock_extensionBasedWithNilConditionalCompilation
  • mock_extensionBasedTypeRespectsMockAttributes
  • mock_generatedForType_whenGenerateMockIsTrue
  • mock_generatedForType_whenEnableMockGenerationIsTrue
  • mock_notGeneratedForType_whenGenerateMockIsDefault
  • mock_notGeneratedForType_whenGenerateMockIsFalse
  • mock_generatedOnlyForOptedInTypes_whenMixOfGenerateMockValues
  • mock_crossModuleTypeWithGenerateMockIsSkipped

Test plan

  • All 768 tests pass
  • SwiftFormat lint clean
  • No test logic changed — pure move refactor

🤖 Generated with Claude Code

Break up the 12,650-line monolithic test file into 6 focused files
to improve readability and navigability for both humans and agents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dfed dfed marked this pull request as ready for review April 6, 2026 21:57
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e33f0f5) to head (af7a727).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #223   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           40        40           
  Lines         6128      6128           
=========================================
  Hits          6128      6128           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dfed dfed merged commit 28ef663 into main Apr 6, 2026
19 checks passed
@dfed dfed deleted the dfed/split-mock-generation-tests branch April 6, 2026 22:00
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.

1 participant