Skip to content

Commit

Permalink
Move soundcloud test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jan 22, 2018
1 parent d75c74f commit ab03d97
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 19 deletions.
12 changes: 12 additions & 0 deletions packages/metascraper-soundcloud/__snapshots__/index.js.snap-shot
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exports['song 1'] = {
"author": "Beauty Brain",
"description": "Thanks for 5.000 likes on https://www.facebook.com/BeautyBrainMusic :D <3 <3 <3",
"date": "2014-01-27T16:19:55.000Z",
"image": "https://i1.sndcdn.com/artworks-000069142357-nwttc6-t500x500.jpg",
"lang": "en",
"logo": "https://a-v2.sndcdn.com/assets/images/sc-icons/ios-a62dfc8f.png",
"publisher": "SoundCloud",
"title": "Swag Bandicoot [FREE DOWNLOAD]",
"url": "https://soundcloud.com/beautybrainsp/beauty-brain-swag-bandicoot"
}

9 changes: 8 additions & 1 deletion packages/metascraper-soundcloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
"@metascraper/helpers": "^3.4.3"
},
"devDependencies": {
"clear-module": "latest",
"lodash": "latest",
"metascraper": "latest",
"mocha": "latest",
"nyc": "latest",
"should": "latest",
"snap-shot": "latest",
"standard": "latest"
},
"engines": {
Expand All @@ -33,7 +40,7 @@
"index.js"
],
"scripts": {
"test": "exit 0"
"test": "NODE_PATH=.. TZ=UTC NODE_ENV=test nyc mocha test"
},
"license": "MIT",
"lint-staged": {
Expand Down
14 changes: 14 additions & 0 deletions packages/metascraper-soundcloud/test/.metascraperrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"rules": [
"metascraper-soundcloud",
"metascraper-author",
"metascraper-date",
"metascraper-description",
"metascraper-image",
"metascraper-lang",
"metascraper-logo",
"metascraper-publisher",
"metascraper-title",
"metascraper-url"
]
}
32 changes: 32 additions & 0 deletions packages/metascraper-soundcloud/test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict'

const clearModule = require('clear-module')
const snapshot = require('snap-shot')
const { promisify } = require('util')
const { resolve } = require('path')
const fs = require('fs')

const readFile = promisify(fs.readFile)

let metascraper

describe('metascraper-soundcloud', () => {
before(() => {
clearModule('metascraper')
process.env.METASCRAPER_CONFIG_CWD = __dirname
metascraper = require('metascraper')
})

after(() => {
clearModule('metascraper')
delete process.env.METASCRAPER_CONFIG_CWD
})

it('song', async () => {
const html = await readFile(resolve(__dirname, 'fixtures/song.html'))
const url = 'https://soundcloud.com/beautybrainsp/beauty-brain-swag-bandicoot'

const metadata = await metascraper({ html, url })
snapshot(metadata)
})
})
6 changes: 6 additions & 0 deletions packages/metascraper-soundcloud/test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--require should
--reporter spec
--timeout 120000
--slow 300
--bail
--recursive
18 changes: 0 additions & 18 deletions packages/metascraper/test/integration/soundcloud/index.js

This file was deleted.

0 comments on commit ab03d97

Please sign in to comment.