Skip to content

Commit d1fa31a

Browse files
committed
Update tests
1 parent 13e0528 commit d1fa31a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

__tests__/spotify-web-api.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ describe('Spotify Web API', () => {
18591859
expect(method).toBe(superagent.put);
18601860
expect(uri).toBe('https://api.spotify.com/v1/me/player');
18611861
expect(JSON.parse(options.data)).toEqual({
1862-
device_ids: ['deviceId'],
1862+
device_ids : ['my-device-id'],
18631863
play: true
18641864
});
18651865
expect(options.query).toBeFalsy();
@@ -1873,8 +1873,7 @@ describe('Spotify Web API', () => {
18731873
});
18741874

18751875
api
1876-
.transferMyPlayback({
1877-
deviceIds: ['deviceId'],
1876+
.transferMyPlayback(['my-device-id'], {
18781877
play: true
18791878
})
18801879
.then(
@@ -2090,6 +2089,8 @@ describe('Spotify Web API', () => {
20902089
expect(method).toBe(superagent.put);
20912090
expect(uri).toBe('https://api.spotify.com/v1/me/player/repeat');
20922091
expect(options.query).toBeTruthy();
2092+
expect(options.query.state).toEqual('off');
2093+
expect(options.query.device_id).toEqual('some-device-id');
20932094
expect(options.body).toBeFalsy();
20942095
callback();
20952096
});
@@ -2100,7 +2101,7 @@ describe('Spotify Web API', () => {
21002101
accessToken: accessToken
21012102
});
21022103

2103-
api.setRepeat({ state: 'off' }).then(
2104+
api.setRepeat('off', { device_id: 'some-device-id' }).then(
21042105
function(data) {
21052106
done();
21062107
},
@@ -2121,6 +2122,7 @@ describe('Spotify Web API', () => {
21212122
expect(method).toBe(superagent.put);
21222123
expect(uri).toBe('https://api.spotify.com/v1/me/player/shuffle');
21232124
expect(options.query).toBeTruthy();
2125+
expect(options.query.state).toEqual(false)
21242126
expect(options.body).toBeFalsy();
21252127
callback();
21262128
});
@@ -2131,7 +2133,7 @@ describe('Spotify Web API', () => {
21312133
accessToken: accessToken
21322134
});
21332135

2134-
api.setShuffle({ state: 'false' }).then(
2136+
api.setShuffle(false).then(
21352137
function(data) {
21362138
done();
21372139
},

src/spotify-web-api.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ SpotifyWebApi.prototype = {
11511151
* @returns {Promise|undefined} A promise that if successful, resolves into an empty response,
11521152
* otherwise an error. Not returned if a callback is given.
11531153
*/
1154-
skipToPrevious: function(callback) {
1154+
skipToPrevious: function(options, callback) {
11551155
return WebApiRequest.builder(this.getAccessToken())
11561156
.withPath('/v1/me/player/previous')
11571157
.withQueryParameters(
@@ -1170,7 +1170,7 @@ SpotifyWebApi.prototype = {
11701170
* @returns {Promise|undefined} A promise that if successful, resolves into an empty response,
11711171
* otherwise an error. Not returned if a callback is given.
11721172
*/
1173-
skipToNext: function(callback) {
1173+
skipToNext: function(options, callback) {
11741174
return WebApiRequest.builder(this.getAccessToken())
11751175
.withPath('/v1/me/player/next')
11761176
.withQueryParameters(
@@ -1211,7 +1211,7 @@ SpotifyWebApi.prototype = {
12111211
* @param {string} [state] State (track, context, or off)
12121212
* @param {Object} [options] Options, being device_id. If left empty will target the user's currently active device.
12131213
* @param {requestCallback} [callback] Optional callback method to be called instead of the promise.
1214-
* @example setRepeat({state: 'context'}).then(...)
1214+
* @example setRepeat('context', {}).then(...)
12151215
* @returns {Promise|undefined} A promise that if successful, resolves into an empty response,
12161216
* otherwise an error. Not returned if a callback is given.
12171217
*/
@@ -1232,7 +1232,7 @@ SpotifyWebApi.prototype = {
12321232

12331233
/**
12341234
* Set Shuffle Mode On The Current User's Playback
1235-
* @param {string} [state] State (true, false)
1235+
* @param {boolean} [state] State
12361236
* @param {Object} [options] Options, being device_id. If left empty will target the user's currently active device.
12371237
* @param {requestCallback} [callback] Optional callback method to be called instead of the promise.
12381238
* @example setShuffle({state: 'false'}).then(...)

0 commit comments

Comments
 (0)