pinafore/tests/unit/test-unescape.mjs

24 lines
1.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* global describe, it */
import assert from 'assert'
import { unescape } from '../../src/routes/_thirdparty/unescape/unescape.js'
describe('test-unescape.js', () => {
it('unescapes html correctly', () => {
assert.deepStrictEqual(unescape('What I’ve learned'), 'What Ive 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 �')
})
})