ng-elasticsearch-sanitize
Version:
Elastic Search Sring Sanitizer for Angular
22 lines (19 loc) • 601 B
JavaScript
(function () {
'use strict';
describe('String Escaper', function () {
var esc,
result;
describe('escapes strings correctly', function () {
beforeEach(function () {
module('lx.escapeElastic');
inject(function (escapeElastic) {
esc = escapeElastic;
});
});
it('checks the string to actually get escaped', function () {
result = esc('[-!(){}]^"~*?:+/||\\&& AND OR NOT');
expect(result).to.eql('\\[\\-\\!\\(\\)\\{\\}\\]\\^\\"\\~\\*\\?\\:\\+\\/\\||\\\\\\&& \\A\\N\\D \\O\\R \\N\\O\\T ');
});
});
});
}());