Summary
Extract shared purchase-modal test setup and separate the single-bucket and fan-out regression suites so each TypeScript file remains under the project's 500-line guideline.
Current behavior
frontend/src/__tests__/purchase-modal-submit.test.ts in LeanerCloud/cloud-commitments-cli#2071 is 603 lines at 664f80600744d845e5c0af5f30175bf259c8db07. Both suites exercise the real app and modal modules with shared mocks and DOM setup. This is a maintainability issue, not a demonstrated runtime defect.
Expected behavior and proposed change
Keep the same behavioral coverage and test execution order semantics. Move the fan-out cases into a separate test file and extract only the setup genuinely shared by the two suites. Do not duplicate mocks, drop assertions, or change production code.
Verification
Run both suites independently and together, then the frontend suite and typecheck. Confirm every existing regression still runs, including real executePurchase payload assertions and the new in-flight submission tests. Keep module mocking/initialization order intact.
References and scope
CodeRabbit nitpick: LeanerCloud/cloud-commitments-cli#2071 (review).
Follow-up to LeanerCloud/cloud-commitments-cli#2071, LeanerCloud/cloud-commitments-cli#1903, and LeanerCloud/cloud-commitments-cli#1904. Deferred from the purchase correctness fix to avoid restructuring test initialization while fixing the independently confirmed double-submit regression.
Severity: low; internal maintainability only.
Summary
Extract shared purchase-modal test setup and separate the single-bucket and fan-out regression suites so each TypeScript file remains under the project's 500-line guideline.
Current behavior
frontend/src/__tests__/purchase-modal-submit.test.tsin LeanerCloud/cloud-commitments-cli#2071 is 603 lines at664f80600744d845e5c0af5f30175bf259c8db07. Both suites exercise the real app and modal modules with shared mocks and DOM setup. This is a maintainability issue, not a demonstrated runtime defect.Expected behavior and proposed change
Keep the same behavioral coverage and test execution order semantics. Move the fan-out cases into a separate test file and extract only the setup genuinely shared by the two suites. Do not duplicate mocks, drop assertions, or change production code.
Verification
Run both suites independently and together, then the frontend suite and typecheck. Confirm every existing regression still runs, including real executePurchase payload assertions and the new in-flight submission tests. Keep module mocking/initialization order intact.
References and scope
CodeRabbit nitpick: LeanerCloud/cloud-commitments-cli#2071 (review).
Follow-up to LeanerCloud/cloud-commitments-cli#2071, LeanerCloud/cloud-commitments-cli#1903, and LeanerCloud/cloud-commitments-cli#1904. Deferred from the purchase correctness fix to avoid restructuring test initialization while fixing the independently confirmed double-submit regression.
Severity: low; internal maintainability only.