Fix tests

This commit is contained in:
Jonathan Cremin 2017-10-24 19:45:41 +01:00
parent b0b2c452bd
commit ca1fbf9e66
4 changed files with 7 additions and 7 deletions

View file

@ -35,14 +35,14 @@ export function* lookupId(possibleId, type, countrycode) {
cc = possibleId.substr(0, 2); cc = possibleId.substr(0, 2);
id = possibleId.substr(2); id = possibleId.substr(2);
} }
console.log(id)
let path = `/lookup?id=${id}`; let path = `/lookup?id=${id}`;
if (cc) { if (cc) {
path = `/${cc}${path}`; path = `/${cc}${path}`;
} }
const response = yield request.get(apiRoot + path); const response = yield request.get(apiRoot + path);
let result = JSON.parse(response.text); let result = JSON.parse(response.text);
console.log(result);
if (!result.results || result.resultCount === 0 || !result.results[0].collectionId) { if (!result.results || result.resultCount === 0 || !result.results[0].collectionId) {
const error = new Error('Not Found'); const error = new Error('Not Found');
error.status = 404; error.status = 404;

View file

@ -21,8 +21,8 @@ describe('Deezer', function(){
}); });
it('should find album with various artists by search', function* (){ it('should find album with various artists by search', function* (){
const result = yield deezer.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Trevor Nelson Collection 2'}); const result = yield deezer.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Trevor Nelson Collection'});
result.name.should.equal('The Trevor Nelson Collection 2'); result.name.should.equal('The Trevor Nelson Collection');
}); });
it('should find track by search', function* (){ it('should find track by search', function* (){

View file

@ -5,7 +5,7 @@ describe('Spotify', function(){
describe('lookupId', function(){ describe('lookupId', function(){
it('should find album by ID', function* (){ it('should find album by ID', function* (){
const result = yield spotify.lookupId('77UW17CZFyCaRLHdHeofZu', 'album'); const result = yield spotify.lookupId('77UW17CZFyCaRLHdHeofZu', 'album');
result.name.should.equal('Listen'); result.name.should.equal('Listen (Deluxe)');
}); });
it('should find track by ID', function* (){ it('should find track by ID', function* (){

View file

@ -12,7 +12,7 @@ describe('Youtube', function(){
describe('search', function(){ describe('search', function(){
it('should find album by search', function* (){ it('should find album by search', function* (){
const result = yield youtube.search({type: 'track', artist: {name: 'Aesop Rock'}, album: {name: 'Skeconsthon'}, name: 'Zero Dark Thirty'}); const result = yield youtube.search({type: 'track', artist: {name: 'Aesop Rock'}, album: {name: 'Skeconsthon'}, name: 'Zero Dark Thirty'});
result.name.should.equal('Aesop Rock - Zero Dark Thirty'); result.name.should.equal('Aesop Rock - Zero Dark Thirty (Official Video)');
}); });
}); });
}); });