Enable escape and once tests (#4618)

This commit is contained in:
Luiz Américo
2020-01-08 13:43:03 -08:00
committed by Michał Lipiński
parent cefddab1ca
commit 04ebca6c86
2 changed files with 0 additions and 0 deletions

30
test/escape.test.js Normal file
View File

@@ -0,0 +1,30 @@
import assert from 'assert';
import lodashStable from 'lodash';
import escape from '../escape.js';
import unescape from '../unescape.js';
describe('escape', function() {
var escaped = '&<>"'/',
unescaped = '&<>"\'/';
escaped += escaped;
unescaped += unescaped;
it('should escape values', function() {
assert.strictEqual(escape(unescaped), escaped);
});
it('should handle strings with nothing to escape', function() {
assert.strictEqual(escape('abc'), 'abc');
});
it('should escape the same characters unescaped by `_.unescape`', function() {
assert.strictEqual(escape(unescape(escaped)), escaped);
});
lodashStable.each(['`', '/'], function(chr) {
it('should not escape the "' + chr + '" character', function() {
assert.strictEqual(escape(chr), chr);
});
});
});