@@ -10,20 +10,22 @@ const fs = require('fs')
10
10
11
11
const readFile = promisify ( fs . readFile )
12
12
13
- describe ( 'metascraper amazon integration' , ( ) => {
13
+ let metascraper
14
+
15
+ describe ( 'metascraper-amazon' , ( ) => {
14
16
before ( ( ) => {
15
- clearModule . all ( )
17
+ clearModule ( 'metascraper' )
16
18
process . env . METASCRAPER_CONFIG_CWD = __dirname
19
+ metascraper = require ( 'metascraper' )
17
20
} )
18
21
19
22
after ( ( ) => {
20
- clearModule . all ( )
23
+ clearModule ( 'metascraper' )
21
24
delete process . env . METASCRAPER_CONFIG_CWD
22
25
} )
23
26
24
27
describe ( 'amazon.co.uk' , ( ) => {
25
28
it ( 'product url' , async ( ) => {
26
- const metascraper = require ( 'metascraper' )
27
29
const html = await readFile ( resolve ( __dirname , 'fixtures/amazon-co-uk/product-url.html' ) )
28
30
const url = 'https://www.amazon.co.uk/Vegetable-Perfection-tasty-recipes-shoots/dp/1849757097/ref=asap_bc?ie=UTF8'
29
31
const meta = omit ( await metascraper ( { html, url } ) , [ 'date' ] )
@@ -33,7 +35,6 @@ describe('metascraper amazon integration', () => {
33
35
34
36
describe ( 'amazon.com' , ( ) => {
35
37
it ( 'ansi url' , async ( ) => {
36
- const metascraper = require ( 'metascraper' )
37
38
const html = await readFile ( resolve ( __dirname , 'fixtures/amazon-com/ansi-url.html' ) )
38
39
const url = 'https://www.amazon.com/gp/product/B0057OC5O8/'
39
40
const metadata = await metascraper ( { html, url } )
0 commit comments