@@ -40,7 +40,7 @@ func TestPlaylistsManagerCRUD(t *testing.T) {
4040 const playlistName = "empty playlist"
4141
4242 now := time .Now ()
43- id , err := manager .Create (ctx , playlistName , [] int64 { })
43+ id , err := manager .Create (ctx , playlists. CreateArgs { Name : playlistName })
4444 assert .NilErr (t , err , "creating empty playlist" )
4545
4646 expected := playlists.Playlist {
@@ -98,6 +98,27 @@ func TestPlaylistsManagerCRUD(t *testing.T) {
9898
9999 _ , err = manager .Get (ctx , playlist .ID )
100100 assert .NotNilErr (t , err , "expected 'not found' error for deleted playlist" )
101+
102+ const listDescription = "some playlist description"
103+ now = time .Now ()
104+ id , err = manager .Create (ctx , playlists.CreateArgs {
105+ Name : playlistName ,
106+ Description : listDescription ,
107+ })
108+ assert .NilErr (t , err , "creating empty playlist with description" )
109+
110+ expected = playlists.Playlist {
111+ Name : playlistName ,
112+ Desc : listDescription ,
113+ ID : id ,
114+ Public : true ,
115+ CreatedAt : time .Unix (now .Unix (), 0 ), // seconds precision in the db
116+ UpdatedAt : time .Unix (now .Unix (), 0 ), // seconds precision in the db
117+ }
118+
119+ playlist , err = manager .Get (ctx , id )
120+ assert .NilErr (t , err , "getting a single playlist with description" )
121+ assertPlaylist (t , expected , playlist )
101122}
102123
103124// TestPlaylistsManagerNotFoundErrors makes sure that the playlists manager returns
@@ -165,7 +186,8 @@ func TestPlaylistsManagerSongOperations(t *testing.T) {
165186 t .Fatalf ("not enough tracks found in the library for working with playlists" )
166187 }
167188
168- playlistID , err := manager .Create (ctx , "Testing Playlist" , trackIDs )
189+ createArgs := playlists.CreateArgs {Name : "Testing Playlist" , Tracks : trackIDs }
190+ playlistID , err := manager .Create (ctx , createArgs )
169191 assert .NilErr (t , err , "failed while creating a playlist with all tracks" )
170192
171193 playlist , err := manager .Get (ctx , playlistID )
@@ -268,7 +290,7 @@ func TestPlaylistsManagerErrors(t *testing.T) {
268290 }()
269291 manager := playlists .NewManager (lib .ExecuteDBJobAndWait )
270292
271- _ , err := manager .Create (ctx , "" , [] int64 {})
293+ _ , err := manager .Create (ctx , playlists. CreateArgs {})
272294 assert .NotNilErr (t , err ,
273295 "creating a playlist with empty name should have been an error" ,
274296 )
0 commit comments