2015-06-03 21:45:54 -07:00
import 'should' ;
2020-01-18 10:19:20 +00:00
import * as spotify from '../../lib/services/spotify/index.js' ;
2014-12-04 19:17:41 +00:00
describe ( 'Spotify' , function ( ) {
describe ( 'lookupId' , function ( ) {
2018-04-30 22:20:01 +01:00
it ( 'should find album by ID' , async function ( ) {
const result = await spotify . lookupId ( '77UW17CZFyCaRLHdHeofZu' , 'album' ) ;
2018-04-08 16:31:46 +01:00
result . name . should . equal ( 'Listen' ) ;
2014-12-04 19:17:41 +00:00
} ) ;
2014-12-13 12:05:47 +00:00
2018-04-30 22:20:01 +01:00
it ( 'should find track by ID' , async function ( ) {
const result = await spotify . lookupId ( '7dS5EaCoMnN7DzlpT6aRn2' , 'track' ) ;
2015-06-03 21:45:54 -07:00
result . name . should . equal ( 'Take Me To Church' ) ;
2014-12-13 12:05:47 +00:00
} ) ;
2014-12-04 19:17:41 +00:00
} ) ;
describe ( 'search' , function ( ) {
2018-04-30 22:20:01 +01:00
it ( 'should find album by search' , async function ( ) {
const result = await spotify . search ( { type : 'album' , artist : { name : 'David Guetta' } , name : 'Listen (Deluxe)' } ) ;
2015-06-03 21:45:54 -07:00
result . name . should . equal ( 'Listen (Deluxe)' ) ;
2014-12-04 19:17:41 +00:00
} ) ;
2017-05-07 20:36:20 +01:00
2018-04-30 22:20:01 +01:00
it ( 'should find br album by search' , async function ( ) {
const result = await spotify . search ( { type : 'album' , artist : { name : 'Anavitória' } , name : 'Fica' } ) ;
2017-05-07 22:16:43 +01:00
result . name . should . equal ( 'Fica' ) ;
} ) ;
2018-04-30 22:20:01 +01:00
it ( 'should find album by various artists by search' , async function ( ) {
const result = await spotify . search ( { type : 'album' , artist : { name : 'Various Artists' } , name : 'The Get Down Part II: Original Soundtrack From The Netflix Original Series' } ) ;
2017-05-07 20:36:20 +01:00
result . name . should . equal ( 'The Get Down Part II: Original Soundtrack From The Netflix Original Series' ) ;
} ) ;
2014-12-04 19:17:41 +00:00
} ) ;
describe ( 'parseUrl' , function ( ) {
2018-04-30 22:20:01 +01:00
it ( 'should parse url into ID' , async function ( ) {
const result = await spotify . parseUrl ( 'https://play.spotify.com/album/77UW17CZFyCaRLHdHeofZu' ) ;
2015-06-03 21:45:54 -07:00
result . id . should . equal ( '77UW17CZFyCaRLHdHeofZu' ) ;
2014-12-04 19:17:41 +00:00
} ) ;
} ) ;
} ) ;