2020-04-29 18:44:27 +03:00
|
|
|
const should = require('should');
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2020-04-29 18:44:27 +03:00
|
|
|
// Stuff we are testing
|
2021-10-06 12:52:46 +03:00
|
|
|
const encode = require('../../../../core/frontend/helpers/encode');
|
2014-10-10 18:54:07 +04:00
|
|
|
|
|
|
|
describe('{{encode}} helper', function () {
|
|
|
|
it('can escape URI', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const uri = '$pecial!Charact3r(De[iver]y)Foo #Bar';
|
|
|
|
const expected = '%24pecial!Charact3r(De%5Biver%5Dy)Foo%20%23Bar';
|
2021-10-04 18:30:54 +03:00
|
|
|
const escaped = encode(uri);
|
2014-10-10 18:54:07 +04:00
|
|
|
|
|
|
|
should.exist(escaped);
|
|
|
|
String(escaped).should.equal(expected);
|
|
|
|
});
|
|
|
|
});
|