-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
40 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,8 @@ | |
] | ||
}, | ||
"standard": { | ||
"globals": [ | ||
"describe", | ||
"it" | ||
"env": [ | ||
"mocha" | ||
] | ||
}, | ||
"version": "2.0.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
packages/metascraper/test/unit/custom-rules/.metascraperrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
"rules": [ | ||
"metascraper-author", | ||
"metascraper-date", | ||
"metascraper-description", | ||
"metascraper-image", | ||
"metascraper-logo", | ||
{"metascraper-clearbit-logo": { | ||
"format": "jpg" | ||
}}, | ||
"metascraper-publisher", | ||
"metascraper-title", | ||
"metascraper-url" | ||
"metascraper-author", | ||
"metascraper-date", | ||
"metascraper-description", | ||
"metascraper-image", | ||
"metascraper-logo", | ||
{"metascraper-clearbit-logo": { | ||
"format": "jpg" | ||
}}, | ||
"metascraper-publisher", | ||
"metascraper-title", | ||
"metascraper-url" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
'use strict' | ||
|
||
const clearModule = require('clear-module') | ||
const should = require('should') | ||
const metascraper = require('../../..') | ||
|
||
it('loading custom rules', async () => { | ||
const url = 'https://facebook.com' | ||
const html = '<div></div>' | ||
const meta = await metascraper({ url, html }) | ||
should(meta.logo).be.equal( | ||
'https://logo.clearbit.com/facebook.com?size=128&format=jpg' | ||
) | ||
|
||
describe('custom rules', () => { | ||
before(clearModule.all) | ||
after(clearModule.all) | ||
|
||
it('loading custom rules', async () => { | ||
process.env.METASCRAPER_CONFIG_CWD = __dirname | ||
const metascraper = require('../../..') | ||
|
||
const url = 'https://facebook.com' | ||
const html = '<div></div>' | ||
const meta = await metascraper({ url, html }) | ||
should(meta.logo).be.equal( | ||
'https://logo.clearbit.com/facebook.com?size=128&format=jpg' | ||
) | ||
}) | ||
}) |