wip: migrate to bun

This commit is contained in:
jdalton
2023-09-16 14:47:50 -07:00
parent 2da024c3b4
commit 97d4a2fe19
1052 changed files with 30244 additions and 26856 deletions

40
test/unescape.spec.ts Normal file
View File

@@ -0,0 +1,40 @@
import assert from 'node:assert';
import lodashStable from 'lodash';
import unescape from '../src/unescape';
import escape from '../src/escape';
describe('unescape', () => {
let escaped = '&<>"'/',
unescaped = '&<>"\'/';
escaped += escaped;
unescaped += unescaped;
it('should unescape entities in order', () => {
assert.strictEqual(unescape('&amp;lt;'), '&lt;');
});
it('should unescape the proper entities', () => {
assert.strictEqual(unescape(escaped), unescaped);
});
it('should handle strings with nothing to unescape', () => {
assert.strictEqual(unescape('abc'), 'abc');
});
it('should unescape the same characters escaped by `_.escape`', () => {
assert.strictEqual(unescape(escape(unescaped)), unescaped);
});
it('should handle leading zeros in html entities', () => {
assert.strictEqual(unescape('&#39;'), "'");
assert.strictEqual(unescape('&#039;'), "'");
assert.strictEqual(unescape('&#000039;'), "'");
});
lodashStable.each(['&#96;', '&#x2F;'], (entity) => {
it(`should not unescape the "${entity}" entity`, () => {
assert.strictEqual(unescape(entity), entity);
});
});
});