feat: verify scanner engine acceptance criteria
Confirm normalization + 0.85 threshold, IsIgnored skip, per-artist scoping, and zero-threshold→default contract. Added TestScanArtist_ZeroThresholdUsesDefault, fixed gofmt on two test files. Coverage: scanner 90.3%, normalize 100.0%.
This commit is contained in:
@@ -82,6 +82,30 @@ func TestScanArtist(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestScanArtist_ZeroThresholdUsesDefault(t *testing.T) {
|
||||
db := newTestDB(t)
|
||||
defer db.Close()
|
||||
|
||||
seedArtist(t, db, "artist-1", "Pink Floyd")
|
||||
seedLocalAlbum(t, db, "l1", "artist-1", "The Wall")
|
||||
seedExternalRelease(t, db, "rg1", "artist-1", "The Wall", false)
|
||||
seedExternalRelease(t, db, "rg2", "artist-1", "Animals", false)
|
||||
|
||||
// Pass 0 (zero value / unset) and the explicit default; results must match.
|
||||
zero, err := ScanArtist(context.Background(), db, "artist-1", 0)
|
||||
if err != nil {
|
||||
t.Fatalf("ScanArtist(0) error: %v", err)
|
||||
}
|
||||
explicit, err := ScanArtist(context.Background(), db, "artist-1", DefaultThreshold)
|
||||
if err != nil {
|
||||
t.Fatalf("ScanArtist(%v) error: %v", DefaultThreshold, err)
|
||||
}
|
||||
if len(zero) != len(explicit) {
|
||||
t.Errorf("ScanArtist(0) returned %d missing, ScanArtist(%v) returned %d; must match",
|
||||
len(zero), DefaultThreshold, len(explicit))
|
||||
}
|
||||
}
|
||||
|
||||
func TestScanArtist_IgnoredNotReported(t *testing.T) {
|
||||
db := newTestDB(t)
|
||||
defer db.Close()
|
||||
|
||||
Reference in New Issue
Block a user