test(hub): Part 2 coverage for collections and common (AAP-72868) #3742
MSW is wired for repository lookup, collection-versions search, modify, and task polling, but the test only checks that title contains "delete" and that actionFn resolves.
Please assert the delete path more directly—e.g. POST …/modify/ body (remove_content_units, base_version), that expected endpoints were called, and/or task completion—so a no-op actionFn cannot pass.
Most new Hub tests in this PR use onUnhandledRequest: 'error'. This file uses 'warn', so a missing or mistyped handler may not fail CI.
Recommend 'error' here once handlers cover every request deleteCollectionFromRepository issues.
Mocking ToolbarAsyncSelectFilterBuilder means these tests only smoke-check that hooks return objects/column headers—not version picker behavior or API wiring.
Acceptable for coverage epic part 2, but consider a follow-up with MSW (or less mocking) if we want regression signal comparable to CollectionContents / useSignAllCollections.
waitForTask(..., 10, 1, 5) polls every 1 ms. Hub CI is green, but this can flake on slower runners.
Consider fake timers or a slightly larger interval if we see intermittent failures.
Strong MSW coverage overall (request, hub-api-utils, collection pages, sign-all modal). Four inline suggestions: tighten delete-hook assertions, use onUnhandledRequest: 'error' for that test, richer version-selector tests later, and slightly less aggressive waitForTask polling in tests.
 Quality Gate passed
Issues
 0 New issues
 0 Accepted issues
Measures
 0 Security Hotspots
 0.0% Coverage on New Code
 0.0% Duplication on New Code
<!-- sqra-placement-anchor -->
See analysis details on SonarQube Cloud
Reviewed the current revision. The earlier review feedback is addressed or acknowledged, and all required checks are green. I found no additional actionable issues.
---
AI-generated. Review for accuracy.
LGTM
lgalis
acruzgon
Summary
Adds Vitest coverage for Hub collections/ and common/ as part of AAP-72868:
hub-api-utils,request,useGetFn) and small utilitiesAll new tests use MSW for HTTP mocking and follow existing hub test patterns.
Type of Change
Risk Analysis - REQUIRED
Dependencies
None.
Testing
Ephemeral E2E Tests
Once PR is ready and preliminary checks pass, trigger tests by posting a comment
/run-playwrighton this PR.Manual Testing
cd frontend/hub && npx vitest run collections commoncd frontend/hub && npm run tscScreenshots
N/A (test-only change).
Made with Cursor