Skip to content

Commit

Permalink
Update testing setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jan 22, 2018
1 parent a043f93 commit d75c74f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/metascraper-amazon/test/.metascraperrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"metascraper-date",
"metascraper-description",
"metascraper-image",
"metascraper-lang",
"metascraper-logo",
"metascraper-publisher",
"metascraper-title",
Expand Down
11 changes: 6 additions & 5 deletions packages/metascraper-amazon/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@ const fs = require('fs')

const readFile = promisify(fs.readFile)

describe('metascraper amazon integration', () => {
let metascraper

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

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

describe('amazon.co.uk', () => {
it('product url', async () => {
const metascraper = require('metascraper')
const html = await readFile(resolve(__dirname, 'fixtures/amazon-co-uk/product-url.html'))
const url = 'https://www.amazon.co.uk/Vegetable-Perfection-tasty-recipes-shoots/dp/1849757097/ref=asap_bc?ie=UTF8'
const meta = omit(await metascraper({ html, url }), ['date'])
Expand All @@ -33,7 +35,6 @@ describe('metascraper amazon integration', () => {

describe('amazon.com', () => {
it('ansi url', async () => {
const metascraper = require('metascraper')
const html = await readFile(resolve(__dirname, 'fixtures/amazon-com/ansi-url.html'))
const url = 'https://www.amazon.com/gp/product/B0057OC5O8/'
const metadata = await metascraper({ html, url })
Expand Down

0 comments on commit d75c74f

Please sign in to comment.