You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mercury-parser/src/extractors/generic/content/scoring/score-commas.test.js

21 lines
511 B
JavaScript

import assert from 'assert'
import cheerio from 'cheerio'
import { scoreCommas } from './index'
describe('Scoring utils', () => {
describe('scoreCommas(text)', () => {
it(`returns 0 if text has no commas`, () => {
assert.equal(scoreCommas("Foo bar"), 0)
})
it(`returns a point for every comma in the text`, () => {
assert.equal(scoreCommas('Foo, bar'), 1)
assert.equal(scoreCommas('Foo, bar, baz'), 2)
assert.equal(scoreCommas('Foo, bar, baz, bat'), 3)
})
})
})