article-parser
Version:
To extract main article from given URL
49 lines (37 loc) • 1.11 kB
JavaScript
// config.test
/* eslint-env jest */
import {
setParserOptions,
getParserOptions,
setSanitizeHtmlOptions,
getSanitizeHtmlOptions
} from './config.js'
test('Testing setParserOptions/getParserOptions methods', () => {
const expectedWPM = 400
setParserOptions({
wordsPerMinute: expectedWPM
})
const actual = getParserOptions()
expect(actual.wordsPerMinute).toEqual(expectedWPM)
})
test('Testing setSanitizeHtmlOptions/getSanitizeHtmlOptions methods', () => {
setSanitizeHtmlOptions({
allowedTags: ['div', 'span'],
allowedAttributes: {
a: ['href', 'title']
}
})
const actual = getSanitizeHtmlOptions()
const actualAllowedAttributes = actual.allowedAttributes
const expectedAllowedAttributes = {
a: ['href', 'title']
}
expect(actualAllowedAttributes).toEqual(expectedAllowedAttributes)
const actualAllowedTags = actual.allowedTags
const expectedAllowedTags = ['div', 'span']
expect(actualAllowedTags).toEqual(expectedAllowedTags)
setSanitizeHtmlOptions({
allowedTags: []
})
expect(getSanitizeHtmlOptions().allowedTags).toEqual([])
})