Add initial Amazon Music support

This commit is contained in:
Jonathan Cremin 2018-04-08 16:31:46 +01:00
parent bd85678303
commit b0fcf55071
25 changed files with 248 additions and 222 deletions

34
test/services/amazon.js Normal file
View file

@ -0,0 +1,34 @@
import 'should';
import * as amazon from '../../lib/services/amazon';
describe('Amazon', function () {
describe('lookupId', function () {
it('should find album by ID', function* () {
const result = yield amazon.lookupId('B00WMW3HFY', 'album');
result.name.should.equal('In Colour [Explicit]');
});
it('should find track by ID', function* (){
const result = yield amazon.lookupId('B00WMW3TUM', 'track');
result.name.should.equal('Sleep Sound');
});
});
describe('search', function(){
it('should find album by search', function* () {
const result = yield amazon.search({type: 'album', artist: {name: 'Jamie xx'}, name: 'In Colour'});
result.name.should.equal('In Colour [Explicit]');
});
it('should find track by search', function* (){
const result = yield amazon.search({type: 'track', artist: {name: 'Jamie xx'}, albumName: 'In Colour', name: 'Loud Places'});
result.name.should.equal('Loud Places');
});
it('should find awkward track by search', function* (){
const result = yield amazon.search({type: 'track', artist: {name: 'Jamie xx'}, albumName: 'In Colour (Remixes)', name: 'Loud Places [Tessela Remix]'});
result.name.should.equal('Loud Places [Tessela Remix]');
});
});
});

View file

@ -26,7 +26,7 @@ describe('Google Play Music', function(){
});
it('should find awkward track by search', function* (){
const result = yield google.search({type: 'track', artist: {name: 'Jamie xx'}, albumName: 'In Colour (Remixes)', name: 'Loud Places [Tessela Remix]'});
const result = yield google.search({type: 'track', artist: {name: 'Jamie xx'}, albumName: 'Loud Places (Remixes)', name: 'Loud Places [Tessela Remix]'});
result.name.should.equal('Loud Places [Tessela Remix]');
});
});

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 (Deluxe)');
result.name.should.equal('Listen');
});
it('should find track by ID', function* (){

View file

@ -1,36 +0,0 @@
import 'should';
import * as xbox from '../../lib/services/xbox';
describe('Xbox Music', function(){
describe('lookupId', function(){
it('should find album by ID', function* (){
const result = yield xbox.lookupId('music.8b558d00-0100-11db-89ca-0019b92a3933', 'album');
result.name.should.equal('Muchas Gracias: The Best Of Kyuss');
});
it('should find track by ID', function* (){
const result = yield xbox.lookupId('music.8f558d00-0100-11db-89ca-0019b92a3933', 'track');
result.name.should.equal('Shine');
});
});
describe('search', function(){
it('should find album by search', function* (){
const result = yield xbox.search({type: 'album', artist: {name: 'Kyuss'}, name: 'Muchas Gracias: The Best Of Kyuss'});
result.name.should.equal('Muchas Gracias: The Best Of Kyuss');
});
it('should find awkward album by search', function* (){
const result = yield xbox.search({type: 'album', artist: {name: 'Anavitória'}, name: 'Fica'});
result.name.should.equal('Fica');
result.artist.name.should.equal('Anavitória');
});
});
describe('lookupUrl', function(){
it('should parse regular url into album ID', function* (){
const result = yield xbox.parseUrl('https://music.microsoft.com/album/kyuss/muchas-gracias-the-best-of-kyuss/bz.8b558d00-0100-11db-89ca-0019b92a3933');
result.id.should.equal('music.8D6KGX5BZ8WB');
});
});
});

View file

@ -5,7 +5,7 @@ describe('Youtube', function(){
describe('lookup', function(){
it('should find album by lookup', function* (){
const result = yield youtube.lookupId('6JnGBs88sL0');
result.name.should.equal('Nelly Furtado - Say It Right');
result.name.should.equal('Say It Right');
});
});