Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 238 additions & 0 deletions __test__/fixtures/queue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
{
"queue": [
{
"album": {
"album_type": "album",
"external_urls": {
"spotify": "https://open.spotify.com/album/6TJmQnO44YE5BtTxH8pop1"
},
"href": "https://api.spotify.com/v1/albums/6TJmQnO44YE5BtTxH8pop1",
"id": "6TJmQnO44YE5BtTxH8pop1",
"images": [
{
"height": 640,
"url": "https://d3rt1990lpmkn.cloudfront.net/original/8e13218039f81b000553e25522a7f0d7a0600f2e",
"width": 629
},
{
"height": 300,
"url": "https://d3rt1990lpmkn.cloudfront.net/original/8c1e066b5d1045038437d92815d49987f519e44f",
"width": 295
},
{
"height": 64,
"url": "https://d3rt1990lpmkn.cloudfront.net/original/d49268a8fc0768084f4750cf1647709e89a27172",
"width": 63
}
],
"name": "Hot Fuss",
"type": "album",
"uri": "spotify:album:6TJmQnO44YE5BtTxH8pop1"
},
"artists": [
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/0C0XlULifJtAgn6ZNCW2eu"
},
"href": "https://api.spotify.com/v1/artists/0C0XlULifJtAgn6ZNCW2eu",
"id": "0C0XlULifJtAgn6ZNCW2eu",
"name": "The Killers",
"type": "artist",
"uri": "spotify:artist:0C0XlULifJtAgn6ZNCW2eu"
}
],
"available_markets": [
"AD",
"AR",
"AT",
"AU",
"BE",
"BG",
"BO",
"BR",
"CH",
"CL",
"CO",
"CR",
"CY",
"CZ",
"DE",
"DK",
"DO",
"EC",
"EE",
"ES",
"FI",
"FR",
"GR",
"GT",
"HK",
"HN",
"HU",
"IE",
"IS",
"IT",
"LI",
"LT",
"LU",
"LV",
"MC",
"MT",
"MY",
"NI",
"NL",
"NO",
"NZ",
"PA",
"PE",
"PH",
"PL",
"PT",
"PY",
"RO",
"SE",
"SG",
"SI",
"SK",
"SV",
"TR",
"TW",
"UY"
],
"disc_number": 1,
"duration_ms": 197160,
"explicit": false,
"external_ids": {
"isrc": "USIR20400195"
},
"external_urls": {
"spotify": "https://open.spotify.com/track/1lDWb6b6ieDQ2xT7ewTC3G"
},
"href": "https://api.spotify.com/v1/tracks/1lDWb6b6ieDQ2xT7ewTC3G",
"id": "1lDWb6b6ieDQ2xT7ewTC3G",
"name": "Somebody Told Me",
"popularity": 0,
"preview_url": "http://d318706lgtcm8e.cloudfront.net/mp3-preview/4c63a3d4eaf7f8f86cfdb8bf46ef3974f4092357",
"track_number": 4,
"type": "track",
"uri": "spotify:track:1lDWb6b6ieDQ2xT7ewTC3G"
},
{
"album": {
"album_type": "album",
"external_urls": {
"spotify": "https://open.spotify.com/album/6TJmQnO44YE5BtTxH8pop1"
},
"href": "https://api.spotify.com/v1/albums/6TJmQnO44YE5BtTxH8pop1",
"id": "6TJmQnO44YE5BtTxH8pop1",
"images": [
{
"height": 640,
"url": "https://d3rt1990lpmkn.cloudfront.net/original/8e13218039f81b000553e25522a7f0d7a0600f2e",
"width": 629
},
{
"height": 300,
"url": "https://d3rt1990lpmkn.cloudfront.net/original/8c1e066b5d1045038437d92815d49987f519e44f",
"width": 295
},
{
"height": 64,
"url": "https://d3rt1990lpmkn.cloudfront.net/original/d49268a8fc0768084f4750cf1647709e89a27172",
"width": 63
}
],
"name": "Hot Fuss",
"type": "album",
"uri": "spotify:album:6TJmQnO44YE5BtTxH8pop1"
},
"artists": [
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/0C0XlULifJtAgn6ZNCW2eu"
},
"href": "https://api.spotify.com/v1/artists/0C0XlULifJtAgn6ZNCW2eu",
"id": "0C0XlULifJtAgn6ZNCW2eu",
"name": "The Killers",
"type": "artist",
"uri": "spotify:artist:0C0XlULifJtAgn6ZNCW2eu"
}
],
"available_markets": [
"AD",
"AR",
"AT",
"AU",
"BE",
"BG",
"BO",
"BR",
"CH",
"CL",
"CO",
"CR",
"CY",
"CZ",
"DE",
"DK",
"DO",
"EC",
"EE",
"ES",
"FI",
"FR",
"GR",
"GT",
"HK",
"HN",
"HU",
"IE",
"IS",
"IT",
"LI",
"LT",
"LU",
"LV",
"MC",
"MT",
"MY",
"NI",
"NL",
"NO",
"NZ",
"PA",
"PE",
"PH",
"PL",
"PT",
"PY",
"RO",
"SE",
"SG",
"SI",
"SK",
"SV",
"TR",
"TW",
"UY"
],
"disc_number": 1,
"duration_ms": 222075,
"explicit": false,
"external_ids": {
"isrc": "USIR20400274"
},
"external_urls": {
"spotify": "https://open.spotify.com/track/0eGsygTp906u18L0Oimnem"
},
"href": "https://api.spotify.com/v1/tracks/0eGsygTp906u18L0Oimnem",
"id": "0eGsygTp906u18L0Oimnem",
"name": "Mr. Brightside",
"popularity": 0,
"preview_url": "http://d318706lgtcm8e.cloudfront.net/mp3-preview/f454c8224828e21fa146af84916fd22cb89cedc6",
"track_number": 2,
"type": "track",
"uri": "spotify:track:0eGsygTp906u18L0Oimnem"
}
]
}
18 changes: 18 additions & 0 deletions __test__/spotify-web-api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,24 @@ describe('Basic tests', function () {
);
});

it('should get queued tracks', function () {
var callback = sinon.spy();
var api = new SpotifyWebApi();
api.getMyCurrentQueue(callback);
that.requests[0].respond(
200,
{ 'Content-Type': 'application/json' },
JSON.stringify(
Object.assign({ currently_playing: fixtures.track }, fixtures.queue)
)
);
expect(that.requests[0].method).toBe('GET');
expect(that.requests.length).toBe(1);
expect(that.requests[0].url).toBe(
'https://api.spotify.com/v1/me/player/queue'
);
});

it('should pause', function () {
var callback = sinon.spy();
var api = new SpotifyWebApi();
Expand Down
Loading