Add comprehensive tests for cleanup store - #8
Merged
Conversation
Add 26 unit tests for cleanupStore covering all functionality: - Initial state validation - Scan operations (orphaned uploads, corrupt objects, versions, empty objects) - Cleanup operations (orphaned uploads, old versions) - Job management (load, status, cancel, refresh) - Analytics and diagnostics loading - Utility actions (clear results, reset state) Coverage improvements: - cleanupStore: 84.5% statements, 100% functions - All 26 tests passing - Removed cleanupStore from coverage exclusions Part of cleanup component testing initiative.
This was referenced Jan 19, 2026
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
Adds comprehensive unit tests for the cleanupStore, significantly improving code coverage and test quality for the storage cleanup feature.
Changes Made
1. New Test File
frontend/src/store/cleanupStore.test.ts(598 lines)2. Test Coverage by Category
Initial State (4 tests)
Scan Operations (6 tests)
scanOrphanedUploads: Success, error, and loading statesscanCorruptObjects: Full scan workflowscanOrphanedVersions: Version scanningscanEmptyObjects: Empty object detectionCleanup Operations (2 tests)
cleanupOrphanedUploads: Cleanup executioncleanupOldVersions: Version cleanup with retentionJob Management (7 tests)
loadJobs: Success, error, and empty statesgetJobStatus: Status retrievalcancelJob: Job cancellationrefreshActiveJob: Active job updates with pollingAnalytics & Diagnostics (3 tests)
loadAnalytics: Storage analytics loadingloadDiagnostics: System diagnostics retrievalUtility Actions (4 tests)
clearScanResults: Result clearingclearJobs: Job list clearingresetState: Complete state resetsetActiveTab: Tab navigation3. Configuration Updates
frontend/vitest.config.tscleanupStore.tsfrom coverage exclusionsCoverage Improvements
Before
cleanupStore.ts: 0% coverage (excluded)After
cleanupStore.ts: 84.5% statements, 70.21% branches, 100% functionsOverall Project Coverage
Testing Performed
Test Patterns Used
Mock Setup
State Reset
Async Testing
Breaking Changes
None - this is purely additive testing.
Dependencies
No new dependencies added.
Checklist
Related Issues
Part of cleanup component testing initiative (follow-up to PR #7).
Next Steps
After this PR is merged, the next phase will add tests for:
Deployment Notes
No deployment changes required - testing only.