pinafore/tests/unit/test-unescape.mjs
Nolan Lawson 16e66346d7
fix!: remove esm package, use native Node ES modules (#2064)
BREAKING CHANGE: Node v12.20+, v14.14+, or v16.0+ is required

* fix!: remove esm package, use native Node ES modules

* fix: fix some CJS imports
2021-07-04 20:19:04 -07:00

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 �')
})
})