2019-11-09 23:25:39 +01:00
|
|
|
|
/* global describe, it */
|
|
|
|
|
import assert from 'assert'
|
2021-07-05 05:19:04 +02:00
|
|
|
|
import { unescape } from '../../src/routes/_thirdparty/unescape/unescape.js'
|
2019-11-09 23:25:39 +01:00
|
|
|
|
|
|
|
|
|
describe('test-unescape.js', () => {
|
|
|
|
|
it('unescapes html correctly', () => {
|
|
|
|
|
assert.deepStrictEqual(unescape('What I’ve learned'), 'What I’ve learned')
|
|
|
|
|
assert.deepStrictEqual(unescape('Hello "world"'), 'Hello "world"')
|
|
|
|
|
assert.deepStrictEqual(unescape('That costs 3£ or 4€'), 'That costs 3£ or 4€')
|
|
|
|
|
assert.deepStrictEqual(unescape('That costs 3£ or 4€'), 'That costs 3£ or 4€') // must be lc
|
|
|
|
|
assert.deepStrictEqual(unescape('Foo & bar & baz'), 'Foo & bar & baz')
|
|
|
|
|
assert.deepStrictEqual(unescape('Winking tongue: 😜'), 'Winking tongue: 😜')
|
|
|
|
|
assert.deepStrictEqual(unescape('Winking tongue as hex: 😜'), 'Winking tongue as hex: 😜')
|
|
|
|
|
assert.deepStrictEqual(unescape('Winking tongue as hex: 😜'), 'Winking tongue as hex: 😜')
|
|
|
|
|
assert.deepStrictEqual(unescape('All's fair'), 'All\'s fair')
|
|
|
|
|
assert.deepStrictEqual(unescape('All's fair'), 'All\'s fair')
|
|
|
|
|
assert.deepStrictEqual(unescape('foo bar'), 'foo bar')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('handles fake html code points', () => {
|
|
|
|
|
assert.deepStrictEqual(unescape('Hello �'), 'Hello �')
|
|
|
|
|
})
|
|
|
|
|
})
|