Switch to Koa, more es6
This commit is contained in:
parent
1090affc9c
commit
b3abff99ae
36 changed files with 25573 additions and 928 deletions
6
test/.eslintrc
Normal file
6
test/.eslintrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"mocha": true
|
||||
}
|
||||
}
|
|
@ -1,15 +1,9 @@
|
|||
"use strict";
|
||||
require('should');
|
||||
|
||||
var lookup = require("../lib/lookup");
|
||||
import 'should';
|
||||
import lookup from '../lib/lookup';
|
||||
|
||||
describe('Search with url', function(){
|
||||
|
||||
it('should find album by url', function(done){
|
||||
lookup("https://play.google.com/music/listen#/album/Bz6wrjczddcj5hurijsv6ohdoay").then(function(result) {
|
||||
result.name.should.equal("Phase 5");
|
||||
done();
|
||||
});
|
||||
it('should find album by url', function* (){
|
||||
let result = yield lookup('https://play.google.com/music/listen#/album/Bz6wrjczddcj5hurijsv6ohdoay');
|
||||
result.name.should.equal('Phase 5');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
"use strict";
|
||||
var assert = require("assert");
|
||||
var should = require('should');
|
||||
|
||||
var beats = require("../../lib/services/beats");
|
||||
|
||||
describe('Beats Music', function(){
|
||||
describe('lookupId', function(){
|
||||
it('should find album by ID', function(done){
|
||||
beats.lookupId("al920431", "album").then(function(result) {
|
||||
result.name.should.equal("Deftones");
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find track by ID', function(done){
|
||||
beats.lookupId("tr6910289", "track").then(function(result) {
|
||||
result.name.should.equal("Californication");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('search', function(){
|
||||
it('should find album by search', function(done){
|
||||
beats.search({type: "album", artist: {name: "Deftones"}, name: "Deftones"}).then(function(result) {
|
||||
result.name.should.equal("Deftones");
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find track by search', function(done){
|
||||
beats.search({type: "track", artist: {name: "Deftones"}, album: {name: "Deftones"}, name: "Hexagram"}).then(function(result) {
|
||||
result.name.should.equal("Hexagram");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('lookupUrl', function(){
|
||||
describe('parseUrl', function(){
|
||||
it('should parse album url into ID', function(done){
|
||||
beats.parseUrl("https://listen.beatsmusic.com/albums/al920431").then(function(result) {
|
||||
result.id.should.equal("al920431");
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should parse track url into ID', function(done){
|
||||
beats.parseUrl("https://listen.beatsmusic.com/albums/al6910269/tracks/tr6910289").then(function(result) {
|
||||
result.id.should.equal("tr6910289");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,56 +1,41 @@
|
|||
"use strict";
|
||||
var assert = require("assert");
|
||||
var should = require('should');
|
||||
|
||||
var deezer = require("../../lib/services/deezer");
|
||||
import 'should';
|
||||
import deezer from '../../lib/services/deezer';
|
||||
|
||||
describe('Deezer', function(){
|
||||
describe('lookupId', function(){
|
||||
it('should find album by ID', function(done){
|
||||
deezer.lookupId("302127", "album").then(function(result) {
|
||||
result.name.should.equal("Discovery");
|
||||
done();
|
||||
});
|
||||
it('should find album by ID', function* (){
|
||||
let result = yield deezer.lookupId('302127', 'album');
|
||||
result.name.should.equal('Discovery');
|
||||
});
|
||||
|
||||
it('should find track by ID', function(done){
|
||||
deezer.lookupId("3135554", "track").then(function(result) {
|
||||
result.name.should.equal("Aerodynamic");
|
||||
done();
|
||||
});
|
||||
it('should find track by ID', function* (){
|
||||
let result = yield deezer.lookupId('3135554', 'track');
|
||||
result.name.should.equal('Aerodynamic');
|
||||
});
|
||||
});
|
||||
|
||||
describe('search', function(){
|
||||
it('should find album by search', function(done){
|
||||
deezer.search({type: "album", artist: {name: "David Guetta"}, name: "Listen (Deluxe)"}).then(function(result) {
|
||||
result.name.should.startWith("Listen");
|
||||
done();
|
||||
});
|
||||
it('should find album by search', function* (){
|
||||
let result = yield deezer.search({type: 'album', artist: {name: 'David Guetta'}, name: 'Listen (Deluxe)'});
|
||||
result.name.should.startWith('Listen');
|
||||
});
|
||||
|
||||
it('should find track by search', function(done){
|
||||
deezer.search({type: "track", artist: {name: "Deftones"}, album: {name: "Deftones"}, name: "Hexagram"}).then(function(result) {
|
||||
result.name.should.equal("Hexagram");
|
||||
done();
|
||||
});
|
||||
it('should find track by search', function* (){
|
||||
let result = yield deezer.search({type: 'track', artist: {name: 'Deftones'}, album: {name: 'Deftones'}, name: 'Hexagram'});
|
||||
result.name.should.equal('Hexagram');
|
||||
});
|
||||
});
|
||||
|
||||
describe('lookupUrl', function(){
|
||||
describe('parseUrl', function(){
|
||||
it('should parse album url into ID', function(done){
|
||||
deezer.parseUrl("http://www.deezer.com/album/302127").then(function(result) {
|
||||
result.id.should.equal(302127);
|
||||
done();
|
||||
});
|
||||
it('should parse album url into ID', function* (){
|
||||
let result = yield deezer.parseUrl('http://www.deezer.com/album/302127');
|
||||
result.id.should.equal(302127);
|
||||
});
|
||||
|
||||
it('should parse track url into ID', function(done){
|
||||
deezer.parseUrl("http://www.deezer.com/track/3135554").then(function(result) {
|
||||
result.id.should.equal(3135554);
|
||||
done();
|
||||
});
|
||||
it('should parse track url into ID', function* (){
|
||||
let result = yield deezer.parseUrl('http://www.deezer.com/track/3135554');
|
||||
result.id.should.equal(3135554);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,55 +1,40 @@
|
|||
"use strict";
|
||||
var assert = require("assert");
|
||||
var should = require('should');
|
||||
|
||||
var google = require("../../lib/services/google");
|
||||
import 'should';
|
||||
import google from '../../lib/services/google';
|
||||
|
||||
describe('Google Play Music', function(){
|
||||
describe('lookupId', function(){
|
||||
it('should find album by ID', function(done){
|
||||
google.lookupId("Byp6lvzimyf74wxi5634ul4tgam", "album").then(function(result) {
|
||||
result.name.should.equal("Listen (Deluxe)");
|
||||
done();
|
||||
});
|
||||
it('should find album by ID', function* (){
|
||||
let result = yield google.lookupId('Byp6lvzimyf74wxi5634ul4tgam', 'album');
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
|
||||
it('should find track by ID', function(done){
|
||||
google.lookupId("Tjosptub24g2dft37lforqnudpe", "track").then(function(result) {
|
||||
result.name.should.equal("Cherub Rock");
|
||||
done();
|
||||
});
|
||||
it('should find track by ID', function* (){
|
||||
let result = yield google.lookupId('Tjosptub24g2dft37lforqnudpe', 'track');
|
||||
result.name.should.equal('Cherub Rock');
|
||||
});
|
||||
});
|
||||
|
||||
describe('search', function(){
|
||||
it('should find album by search', function(done){
|
||||
google.search({type: "album", artist: {name: "David Guetta"}, name: "Listen (Deluxe)"}).then(function(result) {
|
||||
result.name.should.equal("Listen (Deluxe)");
|
||||
done();
|
||||
});
|
||||
it('should find album by search', function* (){
|
||||
let result = yield google.search({type: 'album', artist: {name: 'David Guetta'}, name: 'Listen (Deluxe)'});
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
});
|
||||
|
||||
describe('lookupUrl', function(){
|
||||
it('should parse regular url into album ID', function(done){
|
||||
google.parseUrl("https://play.google.com/music/listen#/album/Byp6lvzimyf74wxi5634ul4tgam/David+Guetta/Listen+(Deluxe)").then(function(result) {
|
||||
result.id.should.equal("Byp6lvzimyf74wxi5634ul4tgam");
|
||||
done();
|
||||
});
|
||||
it('should parse regular url into album ID', function* (){
|
||||
let result = yield google.parseUrl('https://play.google.com/music/listen#/album/Byp6lvzimyf74wxi5634ul4tgam/David+Guetta/Listen+(Deluxe)');
|
||||
result.id.should.equal('Byp6lvzimyf74wxi5634ul4tgam');
|
||||
});
|
||||
|
||||
it('should parse url without ID into album ID', function(done){
|
||||
google.parseUrl("https://play.google.com/music/listen#/album//David+Guetta/Listen+(Deluxe)").then(function(result) {
|
||||
result.id.should.equal("Byp6lvzimyf74wxi5634ul4tgam");
|
||||
done();
|
||||
});
|
||||
it('should parse url without ID into album ID', function* (){
|
||||
let result = yield google.parseUrl('https://play.google.com/music/listen#/album//David+Guetta/Listen+(Deluxe)');
|
||||
result.id.should.equal('Byp6lvzimyf74wxi5634ul4tgam');
|
||||
});
|
||||
|
||||
it('should parse share url into album ID', function(done){
|
||||
google.parseUrl("https://play.google.com/music/m/Byp6lvzimyf74wxi5634ul4tgam").then(function(result) {
|
||||
result.id.should.equal("Byp6lvzimyf74wxi5634ul4tgam");
|
||||
done();
|
||||
});
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,56 +1,41 @@
|
|||
"use strict";
|
||||
var assert = require("assert");
|
||||
var should = require('should');
|
||||
|
||||
var itunes = require("../../lib/services/itunes");
|
||||
import 'should';
|
||||
import itunes from '../../lib/services/itunes';
|
||||
|
||||
describe('iTunes Music', function(){
|
||||
describe('lookupId', function(){
|
||||
it('should find album by ID', function(done){
|
||||
itunes.lookupId("id215206912", "album").then(function(result) {
|
||||
result.name.should.equal("Peace Orchestra");
|
||||
done();
|
||||
});
|
||||
it('should find album by ID', function* (){
|
||||
let result = yield itunes.lookupId('id215206912', 'album');
|
||||
result.name.should.equal('Peace Orchestra');
|
||||
});
|
||||
|
||||
it('should find track by ID', function(done){
|
||||
itunes.lookupId("id215206958", "track").then(function(result) {
|
||||
result.name.should.equal("Double Drums");
|
||||
done();
|
||||
});
|
||||
it('should find track by ID', function* (){
|
||||
let result = yield itunes.lookupId('id215206958', 'track');
|
||||
result.name.should.equal('Double Drums');
|
||||
});
|
||||
});
|
||||
|
||||
describe('search', function(){
|
||||
it('should find album by search', function(done){
|
||||
itunes.search({type: "album", artist: {name: "Deftones"}, name: "Deftones"}).then(function(result) {
|
||||
result.name.should.equal("Deftones");
|
||||
done();
|
||||
});
|
||||
it('should find album by search', function* (){
|
||||
let result = yield itunes.search({type: 'album', artist: {name: 'Deftones'}, name: 'Deftones'});
|
||||
result.name.should.equal('Deftones');
|
||||
});
|
||||
|
||||
it('should find track by search', function(done){
|
||||
itunes.search({type: "track", artist: {name: "Deftones"}, album: {name: "Deftones"}, name: "Hexagram"}).then(function(result) {
|
||||
result.name.should.equal("Hexagram");
|
||||
done();
|
||||
});
|
||||
it('should find track by search', function* (){
|
||||
let result = yield itunes.search({type: 'track', artist: {name: 'Deftones'}, album: {name: 'Deftones'}, name: 'Hexagram'});
|
||||
result.name.should.equal('Hexagram');
|
||||
});
|
||||
});
|
||||
|
||||
describe('lookupUrl', function(){
|
||||
describe('parseUrl', function(){
|
||||
it('should parse album url into ID', function(done){
|
||||
itunes.parseUrl("https://itunes.apple.com/us/album/double-drums/id215206912").then(function(result) {
|
||||
result.id.should.equal("us215206912");
|
||||
done();
|
||||
});
|
||||
it('should parse album url into ID', function* (){
|
||||
let result = yield itunes.parseUrl('https://itunes.apple.com/us/album/double-drums/id215206912');
|
||||
result.id.should.equal('us215206912');
|
||||
});
|
||||
|
||||
it('should parse track url into ID', function(done){
|
||||
itunes.parseUrl("https://itunes.apple.com/us/album/double-drums/id215206912?i=215206958&uo=4").then(function(result) {
|
||||
result.id.should.equal("us215206958");
|
||||
done();
|
||||
});
|
||||
it('should parse track url into ID', function* (){
|
||||
let result = yield itunes.parseUrl('https://itunes.apple.com/us/album/double-drums/id215206912?i=215206958&uo=4');
|
||||
result.id.should.equal('us215206958');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,41 +1,30 @@
|
|||
"use strict";
|
||||
var assert = require("assert");
|
||||
var should = require('should');
|
||||
|
||||
var rdio = require("../../lib/services/rdio");
|
||||
import 'should';
|
||||
import rdio from '../../lib/services/rdio';
|
||||
|
||||
describe('Rdio', function(){
|
||||
describe('lookupId', function(){
|
||||
it('should find album by ID', function(done){
|
||||
rdio.lookupId("Qj4NXr0").then(function(result) {
|
||||
result.name.should.equal("Listen (Deluxe)");
|
||||
done();
|
||||
});
|
||||
it('should find album by ID', function* (){
|
||||
let result = yield rdio.lookupId('Qj4NXr0');
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
});
|
||||
|
||||
describe('search', function(){
|
||||
it('should find album by search', function(done){
|
||||
rdio.search({type: "album", artist: {name: "David Guetta"}, name: "Listen (Deluxe)"}).then(function(result) {
|
||||
result.name.should.equal("Listen (Deluxe)");
|
||||
done();
|
||||
});
|
||||
it('should find album by search', function* (){
|
||||
let result = yield rdio.search({type: 'album', artist: {name: 'David Guetta'}, name: 'Listen (Deluxe)'});
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseUrl', function(){
|
||||
it('should parse regular url into album object', function(done){
|
||||
rdio.parseUrl("https://www.rdio.com/artist/David_Guetta/album/Listen_(Deluxe)/").then(function(result) {
|
||||
result.name.should.equal("Listen (Deluxe)");
|
||||
done();
|
||||
});
|
||||
it('should parse regular url into album object', function* (){
|
||||
let result = yield rdio.parseUrl('https://www.rdio.com/artist/David_Guetta/album/Listen_(Deluxe)/');
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
|
||||
it('should parse short url into album object', function(done){
|
||||
rdio.parseUrl("http://rd.io/x/Qj4NXr0/").then(function(result) {
|
||||
result.name.should.equal("Listen (Deluxe)");
|
||||
done();
|
||||
});
|
||||
it('should parse short url into album object', function* (){
|
||||
let result = yield rdio.parseUrl('http://rd.io/x/Qj4NXr0/');
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,41 +1,30 @@
|
|||
"use strict";
|
||||
var assert = require("assert");
|
||||
var should = require('should');
|
||||
|
||||
var spotify = require("../../lib/services/spotify");
|
||||
import 'should';
|
||||
import spotify from '../../lib/services/spotify';
|
||||
|
||||
describe('Spotify', function(){
|
||||
describe('lookupId', function(){
|
||||
it('should find album by ID', function(done){
|
||||
spotify.lookupId("77UW17CZFyCaRLHdHeofZu", "album").then(function(result) {
|
||||
result.name.should.equal("Listen (Deluxe)");
|
||||
done();
|
||||
});
|
||||
it('should find album by ID', function* (){
|
||||
let result = yield spotify.lookupId('77UW17CZFyCaRLHdHeofZu', 'album');
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
|
||||
it('should find track by ID', function(done){
|
||||
spotify.lookupId("7dS5EaCoMnN7DzlpT6aRn2", "track").then(function(result) {
|
||||
result.name.should.equal("Take Me To Church");
|
||||
done();
|
||||
});
|
||||
it('should find track by ID', function* (){
|
||||
let result = yield spotify.lookupId('7dS5EaCoMnN7DzlpT6aRn2', 'track');
|
||||
result.name.should.equal('Take Me To Church');
|
||||
});
|
||||
});
|
||||
|
||||
describe('search', function(){
|
||||
it('should find album by search', function(done){
|
||||
spotify.search({type: "album", artist: {name: "David Guetta"}, name: "Listen (Deluxe)"}).then(function(result) {
|
||||
result.name.should.equal("Listen (Deluxe)");
|
||||
done();
|
||||
});
|
||||
it('should find album by search', function* (){
|
||||
let result = yield spotify.search({type: 'album', artist: {name: 'David Guetta'}, name: 'Listen (Deluxe)'});
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseUrl', function(){
|
||||
it('should parse url into ID', function(done){
|
||||
spotify.parseUrl("https://play.spotify.com/album/77UW17CZFyCaRLHdHeofZu").then(function(result) {
|
||||
result.id.should.equal("77UW17CZFyCaRLHdHeofZu");
|
||||
done();
|
||||
});
|
||||
it('should parse url into ID', function* (){
|
||||
let result = yield spotify.parseUrl('https://play.spotify.com/album/77UW17CZFyCaRLHdHeofZu');
|
||||
result.id.should.equal('77UW17CZFyCaRLHdHeofZu');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,41 +1,30 @@
|
|||
"use strict";
|
||||
var assert = require("assert");
|
||||
var should = require('should');
|
||||
|
||||
var google = require("../../lib/services/xbox");
|
||||
import 'should';
|
||||
import xbox from '../../lib/services/xbox';
|
||||
|
||||
describe('Xbox Music', function(){
|
||||
describe('lookupId', function(){
|
||||
it('should find album by ID', function(done){
|
||||
google.lookupId("music.8b558d00-0100-11db-89ca-0019b92a3933", "album").then(function(result) {
|
||||
result.name.should.equal("Muchas Gracias: The Best Of Kyuss");
|
||||
done();
|
||||
});
|
||||
it('should find album by ID', function* (){
|
||||
let 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(done){
|
||||
google.lookupId("music.8f558d00-0100-11db-89ca-0019b92a3933", "track").then(function(result) {
|
||||
result.name.should.equal("Shine");
|
||||
done();
|
||||
});
|
||||
it('should find track by ID', function* (){
|
||||
let 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(done){
|
||||
google.search({type: "album", artist: {name: "Kyuss"}, name: "Muchas Gracias: The Best Of Kyuss"}).then(function(result) {
|
||||
result.name.should.equal("Muchas Gracias: The Best Of Kyuss");
|
||||
done();
|
||||
});
|
||||
it('should find album by search', function* (){
|
||||
let 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');
|
||||
});
|
||||
});
|
||||
|
||||
describe('lookupUrl', function(){
|
||||
it('should parse regular url into album ID', function(done){
|
||||
google.parseUrl("https://music.xbox.com/album/kyuss/muchas-gracias-the-best-of-kyuss/8b558d00-0100-11db-89ca-0019b92a3933").then(function(result) {
|
||||
result.id.should.equal("music.8B558D00-0100-11DB-89CA-0019B92A3933");
|
||||
done();
|
||||
});
|
||||
it('should parse regular url into album ID', function* (){
|
||||
let result = yield xbox.parseUrl('https://music.xbox.com/album/kyuss/muchas-gracias-the-best-of-kyuss/8b558d00-0100-11db-89ca-0019b92a3933');
|
||||
result.id.should.equal('music.8B558D00-0100-11DB-89CA-0019B92A3933');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
"use strict";
|
||||
var assert = require("assert");
|
||||
var should = require('should');
|
||||
|
||||
var youtube = require("../../lib/services/youtube");
|
||||
import 'should';
|
||||
import youtube from '../../lib/services/youtube';
|
||||
|
||||
describe('Youtube', function(){
|
||||
describe('search', function(){
|
||||
it('should find album by search', function(done){
|
||||
youtube.search({type: "track", artist: {name: "Aesop Rock"}, album: {name: "Skelethon"}, name: "Zero Dark Thirty"}).then(function(result) {
|
||||
result.name.should.equal("Aesop Rock - Zero Dark Thirty");
|
||||
done();
|
||||
});
|
||||
it('should find album by search', function* (){
|
||||
let result = yield youtube.search({type: 'track', artist: {name: 'Aesop Rock'}, album: {name: 'Skelethon'}, name: 'Zero Dark Thirty'});
|
||||
result.name.should.equal('Aesop Rock - Zero Dark Thirty');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue