1.9 KiB
1.9 KiB
id, title, status, assignee, created_date, labels, dependencies, references, priority
| id | title | status | assignee | created_date | labels | dependencies | references | priority | |
|---|---|---|---|---|---|---|---|---|---|
| ML-7 | Tighten vague test assertions in scrobble_activity and worker tests | Done | 2026-04-20 08:49 |
|
low |
Description
GitHub: created 2026-04-16 · updated 2026-04-20 · closed 2026-04-20
Summary
Project convention: "Assert specific values, not just shape. Wildcard matches (_) in assertions are a signal the test is too vague." Several test files violate this.
Evidence
Bare assert {:ok, _} = ... (9 instances in one file)
test/music_library/scrobble_activity_test.exs: lines 43, 48, 96, 101, 154, 161, 223, 251, 272
The context's entire job is to shape Last.fm payloads correctly, yet the tests don't inspect the returned struct's fields.
assert X != nil (9 sites, 4 files)
test/music_library/worker/prune_assets_test.exs:14, 26, 38test/music_library/worker/fetch_artist_info_test.exs:104, 105test/music_library/barcode_scan_test.exs:23, 63, 100test/music_library/worker/fetch_artist_image_test.exs:28
Other {:ok, _} (selected)
test/music_library/assets_test.exs:29, 30test/music_library/records/similarity_test.exs:218, 229test/music_library/chats_test.exs:162, 203
Fix
For each site, replace with an assertion that pins a specific value the function is responsible for producing.
Acceptance Criteria
scrobble_activity_test.exstests assert specific struct fields on each{:ok, _}site- No
assert X != nilin worker test files (replace with value assertion) - Suite still passes
- #1
scrobble_activity_test.exstests assert specific struct fields on each{:ok, _}site - #2 No
assert X != nilin worker test files (replace with value assertion) - #3 Suite still passes