@@ -1134,7 +1134,8 @@ describe('Spotify Web API', function() {
1134
1134
sinon . stub ( HttpManager , '_makeRequest' , function ( method , options , uri , callback ) {
1135
1135
method . should . equal ( superagent . post ) ;
1136
1136
uri . should . equal ( 'https://api.spotify.com/v1/users/thelinmichael/playlists/5ieJqeLJjjI8iJWaxeBLuK/tracks' ) ;
1137
- options . query . should . eql ( { uris : 'spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M' } ) ;
1137
+ should . not . exist ( options . query ) ;
1138
+ JSON . parse ( options . data ) [ "uris" ] . should . be . an . instanceOf ( Array ) . and . have . lengthOf ( 2 ) ;
1138
1139
callback ( null , { body : { snapshot_id : 'aSnapshotId' } , statusCode : 201 } ) ;
1139
1140
} ) ;
1140
1141
@@ -1151,8 +1152,8 @@ describe('Spotify Web API', function() {
1151
1152
it ( 'should add tracks to playlist with specified index' , function ( done ) {
1152
1153
sinon . stub ( HttpManager , '_makeRequest' , function ( method , options , uri , callback ) {
1153
1154
method . should . equal ( superagent . post ) ;
1155
+ JSON . parse ( options . data ) [ "uris" ] . should . be . an . instanceOf ( Array ) . and . have . lengthOf ( 2 ) ;
1154
1156
options . query . should . eql ( {
1155
- uris : 'spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M' ,
1156
1157
position : 10
1157
1158
} ) ;
1158
1159
callback ( null , { body : { snapshot_id : 'aSnapshotId' } , statusCode : 201 } ) ;
@@ -2068,9 +2069,8 @@ describe('Spotify Web API', function() {
2068
2069
sinon . stub ( HttpManager , '_makeRequest' , function ( method , options , uri , callback ) {
2069
2070
method . should . equal ( superagent . post ) ;
2070
2071
uri . should . equal ( 'https://api.spotify.com/v1/users/thelinmichael/playlists/5ieJqeLJjjI8iJWaxeBLuK/tracks' ) ;
2071
- var trackUris = options . query . uris . split ( "," ) ;
2072
- trackUris . should . be . an . instanceOf ( Array ) . and . have . lengthOf ( 2 ) ;
2073
- should . not . exist ( options . data ) ;
2072
+ should . not . exist ( options . query ) ;
2073
+ JSON . parse ( options . data ) [ "uris" ] . should . be . an . instanceOf ( Array ) . and . have . lengthOf ( 2 ) ;
2074
2074
options . headers . Authorization . should . equal ( 'Bearer long-access-token' ) ;
2075
2075
callback ( ) ;
2076
2076
} ) ;
@@ -2092,9 +2092,8 @@ describe('Spotify Web API', function() {
2092
2092
sinon . stub ( HttpManager , '_makeRequest' , function ( method , options , uri , callback ) {
2093
2093
method . should . equal ( superagent . post ) ;
2094
2094
uri . should . equal ( 'https://api.spotify.com/v1/users/thelinmichael/playlists/5ieJqeLJjjI8iJWaxeBLuK/tracks' ) ;
2095
- var trackUris = options . query . uris . split ( "," ) ;
2096
- trackUris . should . be . an . instanceOf ( Array ) . and . have . lengthOf ( 2 ) ;
2097
- should . not . exist ( options . data ) ;
2095
+ should . not . exist ( options . query ) ;
2096
+ JSON . parse ( options . data ) [ "uris" ] . should . be . an . instanceOf ( Array ) . and . have . lengthOf ( 2 ) ;
2098
2097
options . headers . Authorization . should . equal ( 'Bearer long-access-token' ) ;
2099
2098
callback ( ) ;
2100
2099
} ) ;
0 commit comments