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