Skip to content

Commit

Permalink
Merge 3e99e2c into 90544ff
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiemoore committed May 31, 2016
2 parents 90544ff + 3e99e2c commit 7f207fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/angular-spotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@

getTrackAudioFeatures: function (track) {
track = track.indexOf('spotify:') === -1 ? track : track.split(':')[2];
return this.api('/audio-features/' + track);
return this.api('/audio-features/' + track, 'GET', null, null, this._auth());
},

getTracksAudioFeatures: function (tracks) {
Expand All @@ -481,7 +481,7 @@
});
return this.api('/audio-features/', 'GET', {
ids: tracks ? tracks.toString() : ''
});
}, null, this._auth());
},


Expand Down
8 changes: 7 additions & 1 deletion test/spec/angular-spotify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -999,11 +999,14 @@ describe('angular-spotify', function () {

it('should convert spotify uri to just an id', function () {
spyOn(Spotify, 'api');
Spotify.setAuthToken('TESTING');

Spotify.getTrackAudioFeatures('spotify:artist:0eGsygTp906u18L0Oimnem');

expect(Spotify.api).toHaveBeenCalled();
expect(Spotify.api).toHaveBeenCalledWith('/audio-features/0eGsygTp906u18L0Oimnem');
expect(Spotify.api).toHaveBeenCalledWith('/audio-features/0eGsygTp906u18L0Oimnem', 'GET', null, null, {
'Authorization': 'Bearer TESTING'
});
});

it('should resolve to an object of a track', function () {
Expand Down Expand Up @@ -1069,11 +1072,14 @@ describe('angular-spotify', function () {
it('should convert spotify uris to Ids', function () {
spyOn(Spotify, 'api');

Spotify.setAuthToken('TESTING');
Spotify.getTracksAudioFeatures('spotify:track:0eGsygTp906u18L0Oimnem,spotify:track:1lDWb6b6ieDQ2xT7ewTC3G');

expect(Spotify.api).toHaveBeenCalled();
expect(Spotify.api).toHaveBeenCalledWith('/audio-features/', 'GET', {
ids: '0eGsygTp906u18L0Oimnem,1lDWb6b6ieDQ2xT7ewTC3G'
}, null, {
'Authorization': 'Bearer TESTING'
});
});

Expand Down

0 comments on commit 7f207fe

Please sign in to comment.