Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('Should render a string with tokens', function(done) {
new Thread(Thread.Tasks.nunjucks).start({
render: '{{ data.firstName }} {{ data.lastName }}',
context: {
data: {
firstName: 'Travis',
lastName: 'Tidwell'
}
},
filters: {
test: function(string, param) {
var retVal = this.env.params.form + ' : ' + string;
if (param) {
retVal += ' : ' + param;
}
return retVal;
}
}
it('Should not expose private context variables.', function(done) {
new Thread(Thread.Tasks.nunjucks).start({
render: '{{ _private.secret }}',
context: {
_private: {
secret: '5678'
},
form: '123',
data: {
firstName: 'Travis',
lastName: 'Tidwell'
}
},
filters: {
test: function(string, param) {
var retVal = this.env.params.form + ' : ' + string;
if (param) {
retVal += ' : ' + param;