combine.fm/test/services/spotify.js

41 lines
1.6 KiB
JavaScript
Raw Normal View History

2015-06-03 21:45:54 -07:00
import 'should';
2020-01-18 10:19:20 +00:00
import * as spotify from '../../lib/services/spotify/index.js';
describe('Spotify', function(){
describe('lookupId', function(){
2018-04-30 22:20:01 +01:00
it('should find album by ID', async function (){
const result = await spotify.lookupId('77UW17CZFyCaRLHdHeofZu', 'album');
2018-04-08 16:31:46 +01:00
result.name.should.equal('Listen');
});
2014-12-13 12:05:47 +00:00
2018-04-30 22:20:01 +01:00
it('should find track by ID', async function (){
const result = await spotify.lookupId('7dS5EaCoMnN7DzlpT6aRn2', 'track');
2015-06-03 21:45:54 -07:00
result.name.should.equal('Take Me To Church');
2014-12-13 12:05:47 +00:00
});
});
describe('search', function(){
2018-04-30 22:20:01 +01:00
it('should find album by search', async function (){
const result = await spotify.search({type: 'album', artist: {name: 'David Guetta'}, name: 'Listen (Deluxe)'});
2015-06-03 21:45:54 -07:00
result.name.should.equal('Listen (Deluxe)');
});
2017-05-07 20:36:20 +01:00
2018-04-30 22:20:01 +01:00
it('should find br album by search', async function (){
const result = await spotify.search({type: 'album', artist: {name: 'Anavitória'}, name: 'Fica'});
result.name.should.equal('Fica');
});
2018-04-30 22:20:01 +01:00
it('should find album by various artists by search', async function (){
const result = await spotify.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Get Down Part II: Original Soundtrack From The Netflix Original Series'});
2017-05-07 20:36:20 +01:00
result.name.should.equal('The Get Down Part II: Original Soundtrack From The Netflix Original Series');
});
});
describe('parseUrl', function(){
2018-04-30 22:20:01 +01:00
it('should parse url into ID', async function (){
const result = await spotify.parseUrl('https://play.spotify.com/album/77UW17CZFyCaRLHdHeofZu');
2015-06-03 21:45:54 -07:00
result.id.should.equal('77UW17CZFyCaRLHdHeofZu');
});
});
});