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.
23 lines
603 B
JavaScript
23 lines
603 B
JavaScript
import assert from 'assert'
|
|
import cheerio from 'cheerio'
|
|
|
|
import { scoreLength } from './index'
|
|
|
|
describe('Scoring utils', () => {
|
|
describe('scoreLength(textLength, tagName)', () => {
|
|
it(`returns 0 if length < 50 chars`, () => {
|
|
assert.equal(scoreLength(30), 0)
|
|
})
|
|
|
|
it(`returns varying scores but maxes out at 3`, () => {
|
|
assert.equal(scoreLength(150), 1)
|
|
assert.equal(scoreLength(199), 1.98)
|
|
assert.equal(scoreLength(200), 2)
|
|
assert.equal(scoreLength(250), 3)
|
|
assert.equal(scoreLength(500), 3)
|
|
assert.equal(scoreLength(1500), 3)
|
|
})
|
|
})
|
|
})
|
|
|