test: add test for getSpotifyPlaylist

This commit is contained in:
HugoPoi
2020-09-27 11:23:23 +02:00
parent 81aa88f889
commit d6534ecb05
3 changed files with 1140 additions and 2 deletions
+1122
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -4,7 +4,7 @@
"description": "Download Spotify playlist as mp3 from VKontakte",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha"
},
"bin": {
"vk-music-dl": "./index.js"
@@ -36,5 +36,7 @@
"node-fetch": "^2.6.0",
"promisepipe": "^3.0.0"
},
"devDependencies": {}
"devDependencies": {
"mocha": "^8.1.3"
}
}
+14
View File
@@ -0,0 +1,14 @@
'use strict';
const assert = require('assert');
const {getSpotifyPlaylist} = require('../lib');
describe('getSpotifyPlaylist', function(){
it('acquire and parse playlist from Spotify', async function(){
const playlist = await getSpotifyPlaylist('https://open.spotify.com/playlist/27OFA3NDwoLWtmdMvowA3S');
assert.strictEqual(playlist.name, 'The Best Yoga & Cool-Down Songs');
assert.strictEqual(playlist.type, 'playlist');
assert.strictEqual(playlist.tracks.items.length, 10);
});
});