Fix itunes tests

This commit is contained in:
Jonathan Cremin 2019-03-11 20:59:04 +00:00
parent fc33d1ea92
commit 2a39b2a8e3
4 changed files with 3148 additions and 2557 deletions

View file

@ -29,10 +29,10 @@
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
"bulma": "^0.7.1", "bulma": "^0.7.1",
"co": "~4.6.0", "co": "~4.6.0",
"css-loader": "^0.28.11", "css-loader": "^2.1.1",
"debug": "^3.1.0", "debug": "^4.1.1",
"ejs": "^2.5.9", "ejs": "^2.5.9",
"file-loader": "^1.1.11", "file-loader": "^3.0.1",
"iso8601-duration": "^1.1.1", "iso8601-duration": "^1.1.1",
"kcors": "^2.2.1", "kcors": "^2.2.1",
"koa": "^2.5.1", "koa": "^2.5.1",
@ -41,10 +41,10 @@
"koa-favicon": "~2.0.1", "koa-favicon": "~2.0.1",
"koa-logger": "~3.2.0", "koa-logger": "~3.2.0",
"koa-route": "~3.2.0", "koa-route": "~3.2.0",
"koa-static": "^4.0.2", "koa-static": "^5.0.0",
"koa-views": "^6.1.4", "koa-views": "^6.1.4",
"kue": "^0.11.6", "kue": "^0.11.6",
"mini-css-extract-plugin": "^0.4.0", "mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.11.0", "node-sass": "^4.11.0",
"nodebrainz": "^2.1.1", "nodebrainz": "^2.1.1",
"pg": "^7.4.3", "pg": "^7.4.3",
@ -53,7 +53,7 @@
"sass-loader": "^7.0.1", "sass-loader": "^7.0.1",
"sequelize": "^4.37.6", "sequelize": "^4.37.6",
"spotify-web-api-node": "^4.0.0", "spotify-web-api-node": "^4.0.0",
"superagent": "^3.8.2", "superagent": "^4.1.0",
"vue": "^2.5.17", "vue": "^2.5.17",
"vue-loader": "^15.0.4", "vue-loader": "^15.0.4",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
@ -66,12 +66,12 @@
"webpack-stats-plugin": "^0.2.1" "webpack-stats-plugin": "^0.2.1"
}, },
"devDependencies": { "devDependencies": {
"concurrently": "^3.5.1", "concurrently": "^4.1.0",
"eslint": "^4.19.1", "eslint": "^5.15.1",
"eslint-config-airbnb-base": "^12.1.0", "eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.11.0", "eslint-plugin-import": "^2.11.0",
"istanbul": "^0.4.0", "istanbul": "^0.4.0",
"mocha": "^5.1.1", "mocha": "^6.0.2",
"nodemon": "^1.17.3", "nodemon": "^1.17.3",
"should": "^13.2.1" "should": "^13.2.1"
} }

View file

@ -8,10 +8,10 @@
<ul class="columns is-multiline"> <ul class="columns is-multiline">
<li v-for="match in item.matches" class="column is-2"> <li v-for="match in item.matches" class="column is-2">
<div v-if="match.externalId && match.id != 152"> <div v-if="match.externalId && match.id != 152">
<a v-bind:href="match.streamUrl.replace('www.youtube.com', 'music.youtube.com')"><div v-bind:style="{ backgroundImage: `url(${match.artworkLarge})` }" class="artwork" v-bind:class="{ 'artwork-youtube': match.service === 'youtube' }"> <a v-bind:href="(match.streamUrl || match.purchaseUrl).replace('www.youtube.com', 'music.youtube.com')"><div v-bind:style="{ backgroundImage: `url(${match.artworkLarge})` }" class="artwork" v-bind:class="{ 'artwork-youtube': match.service === 'youtube' }">
</div></a> </div></a>
<div class='service-link has-text-centered'> <div class='service-link has-text-centered'>
<a v-bind:href="match.streamUrl.replace('www.youtube.com', 'music.youtube.com')"><img v-bind:src="`/assets/images/${match.service}.png`" /></a> <a v-bind:href="(match.streamUrl || match.purchaseUrl).replace('www.youtube.com', 'music.youtube.com')"><img v-bind:src="`/assets/images/${match.service}.png`" /></a>
</div> </div>
</div> </div>
<div v-if="match.matching || match.id === 152" class="service"> <div v-if="match.matching || match.id === 152" class="service">

View file

@ -4,12 +4,13 @@ import * as itunes from '../../lib/services/itunes';
describe('iTunes Music', function(){ describe('iTunes Music', function(){
describe('lookupId', function(){ describe('lookupId', function(){
it('should find album by ID', async function (){ it('should find album by ID', async function (){
const result = await itunes.lookupId('id215206912', 'album'); const result = await itunes.lookupId('1445991287', 'album');
console.log(result.name)
result.name.should.equal('Peace Orchestra'); result.name.should.equal('Peace Orchestra');
}); });
it('should find track by ID', async function (){ it('should find track by ID', async function (){
const result = await itunes.lookupId('id215206958', 'track'); const result = await itunes.lookupId('1445927701', 'track');
result.name.should.equal('Double Drums'); result.name.should.equal('Double Drums');
}); });
}); });
@ -34,13 +35,13 @@ describe('iTunes Music', function(){
describe('lookupUrl', function(){ describe('lookupUrl', function(){
describe('parseUrl', function(){ describe('parseUrl', function(){
it('should parse album url into ID', async function (){ it('should parse album url into ID', async function (){
const result = await itunes.parseUrl('https://itunes.apple.com/us/album/double-drums/id215206912'); const result = await itunes.parseUrl('https://itunes.apple.com/us/album/peace-orchestra/1445991287');
result.id.should.equal('us215206912'); result.id.should.equal('us1445991287');
}); });
it('should parse track url into ID', async function (){ it('should parse track url into ID', async function (){
const result = await itunes.parseUrl('https://itunes.apple.com/us/album/double-drums/id215206912?i=215206958&uo=4'); const result = await itunes.parseUrl('https://itunes.apple.com/us/album/double-drums-dj-dsl-mix/1445927689?i=1445927701');
result.id.should.equal('us215206958'); result.id.should.equal('us1445927689');
}); });
}); });
}); });

5668
yarn.lock

File diff suppressed because it is too large Load diff