test: add test for getSpotifyPlaylist

This commit is contained in:
HugoPoi 2020-09-27 10:41:03 +02:00
parent 81aa88f889
commit d6534ecb05
3 changed files with 1140 additions and 2 deletions

1122
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
"description": "Download Spotify playlist as mp3 from VKontakte", "description": "Download Spotify playlist as mp3 from VKontakte",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "mocha"
}, },
"bin": { "bin": {
"vk-music-dl": "./index.js" "vk-music-dl": "./index.js"
@ -36,5 +36,7 @@
"node-fetch": "^2.6.0", "node-fetch": "^2.6.0",
"promisepipe": "^3.0.0" "promisepipe": "^3.0.0"
}, },
"devDependencies": {} "devDependencies": {
"mocha": "^8.1.3"
}
} }

14
test/lib.test.js Normal file
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);
});
});