UNPKG

ng-elasticsearch-sanitize

Version:
22 lines (19 loc) 601 B
(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 '); }); }); }); }());