Test/coverage batch 1 - #1
Merged
Merged
Conversation
ValidateFileSignature sized its read buffer purely by the extension's signature lengths - for .webp that's the 4-byte RIFF header, so the WebP-specific check's `bytesRead >= 12` guard (needed to read the "WEBP" marker at offset 8) was unconditionally false and every WebP upload, including well-formed ones, failed as an "invalid file". The buffer is now at least 12 bytes; forged .webp content is still rejected. Found by the new ImageService test suite and regression- tested there with a real encoded WebP through the full upload path.
The LoggerMessage generator's *.g.cs output (700+ coverable lines under obj/) was counted as uncovered hand-written code. Same generated-code rationale as studylife's migrations exclusion.
… notifications 400 new tests (suite 482 -> 882) from four targeted work packages, lifting business-logic coverage from 25.6% to 42.2%: - SessionManagementService (923 lines, 0% -> 98.6%, 103 tests): full session lifecycle, IP-resolution fallback chain, device/browser/OS detection, VPN risk scoring, hijacking detection (IP/UA change, impossible travel), API sessions. Remaining lines are structurally dead: the only VPN detector never sets Tor/Proxy/Hosting flags, so those risk tiers are unreachable via the public API. - DashboardService (0% -> 92%) + GamificationService (11% -> 100%), 61 tests: dashboard aggregations, trends, ABC analysis, achievements, levels, streaks. - Inventory cluster (104 tests): InventoryService 0% -> 99.8% (CRUD, price history, audit logs, scanner movements, FIFO batch reduction, storage-location math), ExpiryService 30% -> 91% (notification matrix, dedupe), ImageService 0% -> 97% (real SkiaSharp round-trips, signature validation incl. the WebP regression, file-lock error paths). - Notification cluster (131 tests): NotificationService 0% -> 98%, TeamsService 0% -> 100% (webhook payloads, retry/backoff via stub HTTP handlers), EmailService 0% -> 77% - the remainder is the concrete SmtpClient send with no injectable seam, unreachable without opening real sockets. Review notes from writing these (deliberately NOT changed here): NotificationService's InApp path defaults to NotificationChannel.All internally, which can double-send admin emails for low-stock/expiry/ security alerts; two of its catch blocks are unreachable dead code; DashboardService.GetDashboardDataAsync accepts from/to parameters it never uses and GetABCAnalysisAsync ignores its warehouseId filter; SessionManagementService resolves IGeoLocationService but only ever uses it as an availability gate.
|
🎉 This PR is included in version 1.2.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
bump test coverage