test: cover FileShredder denylist and ShredAll confirmation gate#822
Merged
Conversation
Closes the highest-priority test gap from the audit (tests #1 P0, #2 P1): - New FileShredderServiceTests: asserts SecurityException for paths under every protected root (Windows, System32, Program Files, Program Files x86), a case-insensitive variant, ArgumentException on null/empty, FileNotFound / DirectoryNotFound on missing targets, a positive temp-file Quick shred, progress-to-100 reporting, recursive folder shred, and no-delete on a pre-cancelled token. - FileShredderViewModelTests: verifies ShredAll routes through DialogService.Instance.Confirm — file survives on decline, is removed on confirm, and Confirm is never raised when the queue is empty. The denylist is the most data-loss-sensitive guard in the app and previously had zero regression coverage; a refactor of the prefix list could have silently allowed shredding system files with no test failing.
ThrowIfNullOrWhiteSpace throws ArgumentNullException (a subclass of ArgumentException) for null input; Assert.ThrowsAsync requires an exact type match, so the null cases failed. Use Assert.ThrowsAnyAsync to accept both ArgumentNullException (null) and ArgumentException (empty/whitespace).
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.
What
First PR of audit Round 4 (test seams & regression coverage). Closes the two highest-priority test gaps:
[Enhancement]: System Health ΓÇö BIOS update helper (version, manufacturer link, update guide) #1 (P0) —
FileShredderServicesystem-path denylist had zero regression coverage. The newFileShredderServiceTestsasserts:SecurityExceptionfor a file under each protected root (Windows, System32, Program Files, Program Files (x86)) for bothShredFileAsyncandShredFolderAsyncArgumentExceptionon null/empty/whitespace,FileNotFoundException/DirectoryNotFoundExceptionon missing targetsOperationCanceledExceptionand leaves the file intact[Enhancement]: About ΓÇö seamless auto-update (download, replace, restart) #2 (P1) — no test verified the "every destructive op needs
Confirm" contract. AddedShredAllconfirmation-gate tests toFileShredderViewModelTests(same pattern as the Round 2a DeepCleanup tests): file survives on decline, is removed on confirm, andConfirmis never raised for an empty queue.Why
The shredder denylist is the most data-loss-sensitive guard in the app. Before this, a refactor of the prefix list or the
StartsWithcomparison could silently allow shredding system files with no test failing (TEST-PROTOCOL Phase 2 mandate).Notes
test:only — no production code changed, no version bump, no release, no CHANGELOG entry required.