combine.fm/test/services/google.js

41 lines
1.5 KiB
JavaScript
Raw Normal View History

2015-06-03 21:45:54 -07:00
import 'should';
import google from '../../lib/services/google';
describe('Google Play Music', function(){
describe('lookupId', function(){
2015-06-03 21:45:54 -07:00
it('should find album by ID', function* (){
let result = yield google.lookupId('Byp6lvzimyf74wxi5634ul4tgam', 'album');
result.name.should.equal('Listen (Deluxe)');
});
2014-12-13 12:05:47 +00:00
2015-06-03 21:45:54 -07:00
it('should find track by ID', function* (){
let result = yield google.lookupId('Tjosptub24g2dft37lforqnudpe', 'track');
result.name.should.equal('Cherub Rock');
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* (){
let result = yield google.search({type: 'album', artist: {name: 'Jamie xx'}, name: 'In Colour'});
result.name.should.equal('In Colour');
});
});
describe('lookupUrl', function(){
2015-06-03 21:45:54 -07:00
it('should parse regular url into album ID', function* (){
let result = yield google.parseUrl('https://play.google.com/music/listen#/album/Byp6lvzimyf74wxi5634ul4tgam/Jamie+xx/In+Colour');
2015-06-03 21:45:54 -07:00
result.id.should.equal('Byp6lvzimyf74wxi5634ul4tgam');
});
2015-06-03 21:45:54 -07:00
it('should parse url without ID into album ID', function* (){
let result = yield google.parseUrl('https://play.google.com/music/listen#/album//Jamie+xx/In+Colour');
result.id.should.equal('Bvfmezcj3n42lo4xeuslpclbyrm');
});
2015-06-03 21:45:54 -07:00
it('should parse share url into album ID', function* (){
let result = yield google.parseUrl('https://play.google.com/music/m/Byp6lvzimyf74wxi5634ul4tgam');
result.id.should.equal('Byp6lvzimyf74wxi5634ul4tgam');
});
});
});