combine.fm/test/services/spotify.js

31 lines
1 KiB
JavaScript
Raw Normal View History

2015-06-03 21:45:54 -07:00
import 'should';
2015-08-20 23:22:57 +01:00
import * as spotify from '../../lib/services/spotify';
describe('Spotify', function(){
describe('lookupId', function(){
2015-06-03 21:45:54 -07:00
it('should find album by ID', function* (){
2015-08-20 23:22:57 +01:00
const result = yield spotify.lookupId('77UW17CZFyCaRLHdHeofZu', 'album');
2016-01-09 12:27:28 +00:00
result.name.should.equal('Listen');
});
2014-12-13 12:05:47 +00:00
2015-06-03 21:45:54 -07:00
it('should find track by ID', function* (){
2015-08-20 23:22:57 +01:00
const result = yield 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(){
2015-06-03 21:45:54 -07:00
it('should find album by search', function* (){
2015-08-20 23:22:57 +01:00
const result = yield 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)');
});
});
describe('parseUrl', function(){
2015-06-03 21:45:54 -07:00
it('should parse url into ID', function* (){
2015-08-20 23:22:57 +01:00
const result = yield spotify.parseUrl('https://play.spotify.com/album/77UW17CZFyCaRLHdHeofZu');
2015-06-03 21:45:54 -07:00
result.id.should.equal('77UW17CZFyCaRLHdHeofZu');
});
});
});