build spotify-to-navidrome migrator with recovery flow
This commit is contained in:
24
internal/spotify/playlist_url_test.go
Normal file
24
internal/spotify/playlist_url_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package spotify
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParsePlaylistID(t *testing.T) {
|
||||
tests := []struct {
|
||||
in string
|
||||
want string
|
||||
}{
|
||||
{"spotify:playlist:16DZpOTLqZvdbqxEavLmWk", "16DZpOTLqZvdbqxEavLmWk"},
|
||||
{"https://open.spotify.com/playlist/16DZpOTLqZvdbqxEavLmWk?si=abc", "16DZpOTLqZvdbqxEavLmWk"},
|
||||
{"16DZpOTLqZvdbqxEavLmWk", "16DZpOTLqZvdbqxEavLmWk"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
got, err := ParsePlaylistID(tt.in)
|
||||
if err != nil {
|
||||
t.Fatalf("ParsePlaylistID(%q) returned error: %v", tt.in, err)
|
||||
}
|
||||
if got != tt.want {
|
||||
t.Fatalf("ParsePlaylistID(%q) = %q, want %q", tt.in, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user