Skip to content

Test/coverage batch 1 - #1

Merged
lukislp merged 3 commits into
mainfrom
test/coverage-batch-1
Aug 6, 2026
Merged

Test/coverage batch 1#1
lukislp merged 3 commits into
mainfrom
test/coverage-batch-1

Conversation

@lukislp

@lukislp lukislp commented Aug 6, 2026

Copy link
Copy Markdown
Owner

bump test coverage

lukislp added 3 commits August 6, 2026 13:29
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.
@lukislp
lukislp merged commit 2acaa5c into main Aug 6, 2026
9 of 11 checks passed
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.2.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant