mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-05 07:57:06 +02:00
Spotify: Loves export
This commit is contained in:
parent
ed9debc127
commit
2e6319d296
3 changed files with 212 additions and 38 deletions
|
@ -51,3 +51,16 @@ func TestSpotifyListenToListen(t *testing.T) {
|
|||
assert.Equal(t, []string{"https://open.spotify.com/artist/101HSR6JTJqe3DBh6rb8kz"}, info["spotify_artist_ids"])
|
||||
assert.Equal(t, []string{"https://open.spotify.com/artist/101HSR6JTJqe3DBh6rb8kz"}, info["spotify_album_artist_ids"])
|
||||
}
|
||||
|
||||
func TestSavedTrackToLove(t *testing.T) {
|
||||
data, err := os.ReadFile("testdata/track.json")
|
||||
require.NoError(t, err)
|
||||
track := spotify.SavedTrack{}
|
||||
err = json.Unmarshal(data, &track)
|
||||
require.NoError(t, err)
|
||||
love := track.ToLove()
|
||||
created, _ := time.Parse(time.RFC3339, "2022-02-13T21:46:08Z")
|
||||
assert.Equal(t, created, love.Created)
|
||||
assert.Equal(t, time.Duration(187680*time.Millisecond), love.Duration)
|
||||
assert.Equal(t, "Death to the Holy", love.TrackName)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue