Basic testing in place

pull/1/head
Adam Pash 8 years ago
parent 8efcc70eef
commit f3aebb2a16

@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}

@ -5,11 +5,15 @@
"main": "index.js",
"scripts": {
"start": "node ./build",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha --compilers js:babel-register src/**/**/*.test.js"
},
"author": "",
"license": "ISC",
"devDependencies": {},
"devDependencies": {
"babel-preset-es2015": "^6.13.2",
"babel-register": "^6.11.6",
"mocha": "^3.0.2"
},
"dependencies": {
"cheerio": "^0.20.0",
"rollup": "^0.34.10"

@ -1,5 +1,6 @@
export default {
entry: 'index.js',
// entry: 'index.js',
entry: 'src/index.js'
format: 'cjs',
dest: 'bundle.js' // equivalent to --output
dest: 'dist/bundle.js' // equivalent to --output
};

@ -3,7 +3,7 @@ import cheerio from 'cheerio'
import CONSTANTS from './constants'
const GenericContentExtractor = {
flags: {}
flags: {},
// Entry point for parsing html
parse(html, flags={}) {
let $ = cheerio.load(html)
@ -65,7 +65,7 @@ const GenericContentExtractor = {
If weight_nodes is True, use classNames and IDs to determine the
worthiness of nodes.
Returns an lxml node.
Returns cheerio instance $
`
// deep clone the node so we can get back to our initial parsed state
@ -125,11 +125,6 @@ const GenericContentExtractor = {
// else:
// return node
//
// def node_is_sufficient(self, node):
// """Given a node, determine if it is article-like enough to return."""
// return (isinstance(node, lxml.html.HtmlElement) and
// len(inner_text(node)) >= 100)
//
//
// def _extract_best_node(self):
// """ Using a variety of scoring techniques, extract the content most

@ -0,0 +1,7 @@
// Given a node, determine if it's article-like enough to return
export function nodeIsSufficient(node) {
}
// def node_is_sufficient(self, node):
// return (isinstance(node, lxml.html.HtmlElement) and
// len(inner_text(node)) >= 100)
//

@ -0,0 +1,9 @@
import assert from 'assert'
describe('Utils', () => {
describe('nodeIsSufficient(node)', () => {
it("should return true if text length > 100 chars", () => {
assert.equal(true, true)
})
})
})
Loading…
Cancel
Save