mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Enable escape and once tests (#4618)
This commit is contained in:
committed by
Michał Lipiński
parent
cefddab1ca
commit
04ebca6c86
30
test/escape.test.js
Normal file
30
test/escape.test.js
Normal 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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user