Switch to Koa, more es6
This commit is contained in:
parent
1090affc9c
commit
b3abff99ae
36 changed files with 25573 additions and 928 deletions
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue