test: add missing test suites for frontend hooks and backend services#780
Merged
Mosas2000 merged 1 commit intoJun 29, 2026
Merged
Conversation
|
@therealjhay Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
File:
useWatchlist.test.tsx
Mocked the MSW server environment as per frontend testing standards, although the hook relies on localStorage interactions without external API calls.
Covered all major hook functionality including initializing the default state, adding/removing assets, reordering logic, handling watchlists creation, and full import/export flows while validating state persistence.
2. Backend: Usage Metrics Service Tests
File:
usageMetrics.service.test.ts
Utilized vi.mock for the Knex database and application loggers inline with your backend factory strategies.
Covered the UsageMetricsService.record fire-and-forget methods natively, including error handling.
Validated queryAggregates behavior when using both custom buckets/date ranges and default fallback values.
3. Backend: Source Normalization Service Tests
File:
sourceNormalization.service.test.ts
Instantiated a custom TestAdapter that implements ProviderAdapter and registered it with adapterRegistry to simulate full lifecycle mapping, validation, and normalization.
Handled the validation rejection paths and error generation for missing/conflicting adapter schemas.
Validated correct structural data transformations (merging unmapped fields to raw) when saving normalized outputs to the database helper.
4. Backend: Audit Retention Job Tests
File:
auditRetention.job.test.ts
Mimicked the mocking strategy found in supplyVerification jobs.
Fully mocked the injected auditService.applyRetentionPolicy and tested happy paths, overriding the default retention limit, edge cases of returning zero deletions, and error boundaries resulting from failed job executions.
Closes #759
Closes #755
Closes #752
Closes #767