@@ -153,7 +153,7 @@ describe('Basic tests', function() {
153153 api . getArtistAlbums ( '5YyScSZOuBHpoFhGvHFedc' , { limit : 2 } , callback ) ;
154154 that . requests [ 0 ] . respond ( 200 ,
155155 { 'Content-Type' :'application/json' } ,
156- JSON . stringify ( that . fixtures . artist_albums )
156+ JSON . stringify ( that . fixtures . artist_albums_limit_2 )
157157 ) ;
158158 expect ( callback . calledWith ( null , that . fixtures . artist_albums_limit_2 ) ) . to . be . ok ;
159159 expect ( that . requests ) . to . have . length ( 1 ) ;
@@ -450,7 +450,21 @@ describe('Basic tests', function() {
450450 ) ;
451451 expect ( callback . calledWith ( null , '' ) ) . to . be . ok ;
452452 expect ( that . requests ) . to . have . length ( 1 ) ;
453- expect ( that . requests [ 0 ] . url ) . to . equal ( 'https://api.spotify.com/v1/users/jmperezperez/playlists/7Kud0O2IdWLbEGgvBkW9di/tracks' ) ;
453+ expect ( that . requests [ 0 ] . url ) . to . equal ( 'https://api.spotify.com/v1/users/jmperezperez/playlists/7Kud0O2IdWLbEGgvBkW9di/tracks?uris=spotify%3Atrack%3A2Oehrcv4Kov0SuIgWyQY9e' ) ;
454+ } ) ;
455+
456+ it ( 'should add tracks to a playlist, specifying position' , function ( ) {
457+ var callback = sinon . spy ( ) ;
458+ var api = new SpotifyWebApi ( ) ;
459+ api . setAccessToken ( '<example_access_token>' ) ;
460+ api . addTracksToPlaylist ( 'jmperezperez' , '7Kud0O2IdWLbEGgvBkW9di' , [ 'spotify:track:2Oehrcv4Kov0SuIgWyQY9e' ] , { position : 0 } , callback ) ;
461+ that . requests [ 0 ] . respond ( 201 ,
462+ { 'Content-Type' :'application/json' } ,
463+ ''
464+ ) ;
465+ expect ( callback . calledWith ( null , '' ) ) . to . be . ok ;
466+ expect ( that . requests ) . to . have . length ( 1 ) ;
467+ expect ( that . requests [ 0 ] . url ) . to . equal ( 'https://api.spotify.com/v1/users/jmperezperez/playlists/7Kud0O2IdWLbEGgvBkW9di/tracks?uris=spotify%3Atrack%3A2Oehrcv4Kov0SuIgWyQY9e&position=0' ) ;
454468 } ) ;
455469
456470 it ( 'should remove tracks from a playlist' , function ( ) {
0 commit comments