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);
id = possibleId.substr(2);
}
console.log(id)
let path = `/lookup?id=${id}`;
if (cc) {
path = `/${cc}${path}`;
}
const response = yield request.get(apiRoot + path);
let result = JSON.parse(response.text);
console.log(result);
if (!result.results || result.resultCount === 0 || !result.results[0].collectionId) {
const error = new Error('Not Found');
error.status = 404;
@ -121,7 +121,7 @@ export function* search(data) {
purchaseUrl: result.collectionViewUrl,
artwork: {
small: `${result.artworkUrl100.replace('100x100', '200x200').replace('.mzstatic.com', '-ssl.mzstatic.com').replace('http://', 'https://')}`,
large: `${result.artworkUrl100.replace('100x100', '600x600').replace('.mzstatic.com', '-ssl.mzstatic.com').replace('http://', 'https://')}`,
large: `${result.artworkUrl100.replace('100x100', '600x600').replace('.mzstatic.com', '-ssl.mzstatic.com').replace('http://', 'https://')}`,
},
artist: {
name: result.artistName,

View file

@ -21,8 +21,8 @@ describe('Deezer', 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'});
result.name.should.equal('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');
});
it('should find track by search', function* (){

View file

@ -5,7 +5,7 @@ describe('Spotify', function(){
describe('lookupId', function(){
it('should find album by ID', function* (){
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* (){

View file

@ -12,7 +12,7 @@ describe('Youtube', function(){
describe('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'});
result.name.should.equal('Aesop Rock - Zero Dark Thirty');
result.name.should.equal('Aesop Rock - Zero Dark Thirty (Official Video)');
});
});
});