feat: add-test and some fixes #1

Merged
hugopoi merged 4 commits from feat/add-test into master 2020-09-27 11:41:19 +02:00
3 changed files with 1140 additions and 2 deletions
Showing only changes of commit d6534ecb05 - Show all commits

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",
"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
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);
});
});