Skip to content

test: add missing test suites for frontend hooks and backend services#780

Merged
Mosas2000 merged 1 commit into
StellaBridge:mainfrom
therealjhay:resolve-issues-#752-#767-#755-#759
Jun 29, 2026
Merged

test: add missing test suites for frontend hooks and backend services#780
Mosas2000 merged 1 commit into
StellaBridge:mainfrom
therealjhay:resolve-issues-#752-#767-#755-#759

Conversation

@therealjhay

Copy link
Copy Markdown
Contributor
  1. Frontend: Watchlist Hook Tests
    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

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Mosas2000 Mosas2000 merged commit 85aed39 into StellaBridge:main Jun 29, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants