Files
music_library/backlog/completed/ml-169.10.1 - Add-baseline-delete-coverage-for-current-LiveView-paths.md
Claudio Ortolina 00864ae994 Backlog cleanup
2026-05-22 10:28:26 +01:00

100 lines
6.1 KiB
Markdown

---
id: ML-169.10.1
title: Add baseline delete coverage for current LiveView paths
status: Done
assignee:
- Codex
created_date: "2026-05-20 16:31"
updated_date: "2026-05-20 16:37"
labels:
- testing
- coverage
dependencies: []
references:
- ML-169.10
documentation:
- docs/architecture.md
- docs/project-conventions.md
modified_files:
- test/music_library/records_test.exs
- test/music_library_web/live/collection_live/index_test.exs
- test/music_library_web/live/wishlist_live/index_test.exs
- test/music_library_web/live/scrobbled_tracks_live/index_test.exs
- test/music_library_web/live/collection_live/show_test.exs
- test/music_library_web/live/wishlist_live/show_test.exs
- test/music_library_web/live/artist_live/show_test.exs
- test/music_library_web/live/record_set_live/index_test.exs
- test/music_library_web/live/record_set_live/show_test.exs
- test/music_library_web/live/online_store_template_live/index_test.exs
- test/music_library_web/live/scrobble_rules_live/index_test.exs
parent_task_id: ML-169.10
priority: medium
ordinal: 34000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Add focused test coverage for current deletion behavior without implementing the async optimistic UI changes from ML-169.10. This task covers the three stream-backed index paths called out in ML-169.10 and verifies whether other existing user-facing deletion paths lack tests. Scope is limited to tests for current behavior; production delete handlers should not be changed here unless a test reveals an existing broken path that cannot be tested as-is.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Collection index delete is covered by a LiveView test that removes the record from the page and verifies the record is deleted through the Records context.
- [x] #2 Wishlist index delete is covered by a LiveView test that removes the record from the page and verifies the record is deleted through the Records context.
- [x] #3 Scrobbled tracks index delete is covered by a LiveView test that removes the track from the page and verifies the track is deleted through ListeningStats.
- [x] #4 Existing user-facing delete handlers are audited for missing coverage, and any untested current-behavior paths found in that audit receive focused tests or are documented as intentionally out of scope.
- [x] #5 Existing delete tests that only assert UI removal are strengthened with persistence assertions where practical.
- [x] #6 Focused tests for the touched delete paths pass.
<!-- AC:END -->
## Implementation Plan
<!-- SECTION:PLAN:BEGIN -->
## Implementation Plan
1. Add baseline LiveView delete tests for the three ML-169.10 stream-backed index paths without changing production code:
- `test/music_library_web/live/collection_live/index_test.exs`
- `test/music_library_web/live/wishlist_live/index_test.exs`
- `test/music_library_web/live/scrobbled_tracks_live/index_test.exs`
2. Audit current user-facing delete handlers for missing deletion tests. Based on the initial scan, add focused current-behavior tests for untested deletion paths in:
- `test/music_library_web/live/collection_live/show_test.exs`
- `test/music_library_web/live/wishlist_live/show_test.exs`
- `test/music_library_web/live/artist_live/show_test.exs`
- `test/music_library_web/live/record_set_live/index_test.exs`
3. Strengthen existing UI-only deletion tests with persistence assertions where practical:
- `test/music_library_web/live/online_store_template_live/index_test.exs`
- `test/music_library_web/live/scrobble_rules_live/index_test.exs`
4. Run focused tests for the touched files, then update the task with modified files, audit notes, and checked acceptance criteria.
<!-- SECTION:PLAN:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Audited current deletion coverage by scanning user-facing delete handlers and existing delete tests. Added baseline coverage for the three ML-169.10 stream-backed index paths: collection index, wishlist index, and scrobbled tracks index. Added current-behavior coverage for untested delete paths found in collection show, wishlist show, artist record list deletion, and record set index deletion. Strengthened existing UI-only delete tests for online store templates, scrobble rules, and record set show deletion with persistence assertions. Also strengthened Records.delete_record/1 to assert the record is actually gone while preserving the PruneArtistInfo enqueue assertion.
Did not add async success/error/exit handle_async tests from ML-169.10 because those paths do not exist yet; adding them would require implementing the async optimistic UI issue, which is intentionally out of scope for this task.
<!-- SECTION:NOTES:END -->
## Final Summary
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Added baseline test coverage for current delete behavior without changing production delete handlers.
Covered the three ML-169.10 stream-backed index paths: collection index record deletion, wishlist index record deletion, and scrobbled tracks deletion. Also covered additional untested current user-facing delete paths found during the audit: collection show, wishlist show, artist record list deletion, and record set index deletion. Strengthened existing delete tests for online store templates, scrobble rules, record set show deletion, and Records.delete_record/1 so they assert persisted deletion through context lookups.
Validation: `mix test --max-failures 5 test/music_library/records_test.exs test/music_library_web/live/collection_live/index_test.exs test/music_library_web/live/wishlist_live/index_test.exs test/music_library_web/live/scrobbled_tracks_live/index_test.exs test/music_library_web/live/collection_live/show_test.exs test/music_library_web/live/wishlist_live/show_test.exs test/music_library_web/live/artist_live/show_test.exs test/music_library_web/live/record_set_live/index_test.exs test/music_library_web/live/record_set_live/show_test.exs test/music_library_web/live/online_store_template_live/index_test.exs test/music_library_web/live/scrobble_rules_live/index_test.exs` passed with 115 tests.
<!-- SECTION:FINAL_SUMMARY:END -->