feat(genius): fetch artist avatars by name and match names with transliteration suffix
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
795bb7de46
commit
139dd226fa
5 files changed
+144
-1
No files matched your search
@@ -95,3 +95,25 @@ func TestAnnotations(t *testing.T) {
|
||||
require.True(t, notes[0].Verified)
|
||||
require.Equal(t, "https://genius.com/annotations/1", notes[0].Url)
|
||||
}
|
||||
|
||||
type fakeArtists struct {
|
||||
songs []Song
|
||||
artist Artist
|
||||
}
|
||||
|
||||
func (f fakeArtists) Search(context.Context, string) ([]Song, error) { return f.songs, nil }
|
||||
func (f fakeArtists) Artist(context.Context, int64) (Artist, error) { return f.artist, nil }
|
||||
|
||||
func TestArtistImage(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
src := fakeArtists{songs: []Song{
|
||||
{Artist: Artist{ID: 1, Name: "Other", ImageURL: "https://images.genius.com/other.jpg"}},
|
||||
{Artist: Artist{ID: 2, Name: "Некич (Nekich)"}},
|
||||
}, artist: Artist{ID: 2, ImageURL: "https://images.genius.com/nekich.jpg"}}
|
||||
img, err := artistImage(ctx, src, "некич")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "https://images.genius.com/nekich.jpg", img)
|
||||
img, err = artistImage(ctx, src, "Unknown")
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, img)
|
||||
}
|
||||
Reference in new issue
Block a user