combine.fm/test/services/deezer.js

48 lines
1.7 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 deezer from '../../lib/services/deezer';
2014-12-04 21:00:34 +00:00
describe('Deezer', 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 deezer.lookupId('302127', 'album');
2015-06-03 21:45:54 -07:00
result.name.should.equal('Discovery');
2014-12-04 21:00:34 +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 deezer.lookupId('3135554', 'track');
2015-06-03 21:45:54 -07:00
result.name.should.equal('Aerodynamic');
2014-12-04 21:00:34 +00:00
});
});
describe('search', function(){
2015-06-03 21:45:54 -07:00
it('should find album by search', function* (){
2015-11-22 13:02:27 +00:00
const result = yield deezer.search({type: 'album', artist: {name: 'Jamie xx'}, name: 'In Colour'});
result.name.should.startWith('In Colour');
2014-12-04 21:00:34 +00:00
});
2017-05-07 20:57:12 +01:00
it('should find album with various artists by search', function* (){
2017-07-20 14:31:07 +01:00
const result = yield deezer.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Trevor Nelson Collection 2'});
result.name.should.equal('The Trevor Nelson Collection 2');
2017-05-07 20:57:12 +01:00
});
2015-06-03 21:45:54 -07:00
it('should find track by search', function* (){
const result = yield deezer.search({type: 'track', artist: {name: 'Deftones'}, albumName: 'Deftones', name: 'Hexagram'});
2015-06-03 21:45:54 -07:00
result.name.should.equal('Hexagram');
2014-12-04 21:00:34 +00:00
});
});
describe('lookupUrl', function(){
describe('parseUrl', function(){
2015-06-03 21:45:54 -07:00
it('should parse album url into ID', function* (){
2015-08-20 23:22:57 +01:00
const result = yield deezer.parseUrl('http://www.deezer.com/album/302127');
2015-06-03 21:45:54 -07:00
result.id.should.equal(302127);
2014-12-04 21:00:34 +00:00
});
2015-06-03 21:45:54 -07:00
it('should parse track url into ID', function* (){
2015-08-20 23:22:57 +01:00
const result = yield deezer.parseUrl('http://www.deezer.com/track/3135554');
2015-06-03 21:45:54 -07:00
result.id.should.equal(3135554);
2014-12-04 21:00:34 +00:00
});
});
});
});