article-parser
Version:
To extract main article from given URL
35 lines (27 loc) • 828 B
JavaScript
// config.test
/* eslint-env jest */
import {
setSanitizeHtmlOptions,
getSanitizeHtmlOptions
} from './config.js'
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([])
})